1 # Copyright 2004 D. Scott Barninger
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 # Modified from bacula-1.34.5.ebuild for 1.36.0 release
6 # 24 Oct 2004 D. Scott Barninger <barninger at fairfieldcomputers dot com>
8 # added cdrom rescue for 1.36.1
9 # init script now comes from source package not ${FILES} dir
10 # 26 Nov 2004 D. Scott Barninger <barninger at fairfieldcomputers dot com>
12 # fix symlink creation in rescue package in post script
13 # remove mask on x86 keyword
14 # fix post script so it doesn't talk about server config for client-only build
15 # bug #181 - unable to reproduce on 2.4 kernel system so add FEATURES="-sandbox"
16 # 04 Dec 2004 D. Scott Barninger <barninger at fairfieldcomputers dot com>
18 DESCRIPTION="featureful client/server network backup suite"
19 HOMEPAGE="http://www.bacula.org/"
20 SRC_URI="mirror://sourceforge/bacula/${P}.tar.gz"
24 KEYWORDS="x86 ~ppc ~sparc"
25 IUSE="readline tcpd gnome mysql sqlite X static postgres wxwindows"
27 # 2.6 kernel user reports sandbox error with client build
28 # can't replicate this on 2.4 soo...
29 KERNEL=`uname -r | head -c 3`
30 if [ $KERNEL = "2.6" ]; then
31 if [ -n $BUILD_CLIENT_ONLY ]; then
38 #theres a local sqlite use flag. use it -OR- mysql, not both.
39 #mysql is the recommended choice ...
40 #may need sys-libs/libtermcap-compat but try without first
41 DEPEND=">=sys-libs/zlib-1.1.4
43 readline? ( >=sys-libs/readline-4.1 )
44 tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
45 gnome? ( gnome-base/libgnome )
46 gnome? ( app-admin/gnomesu )
47 sqlite? ( =dev-db/sqlite-2* )
48 mysql? ( >=dev-db/mysql-3.23 )
49 postgres? ( >=dev-db/postgresql-7.4.0 )
51 wxwindows? ( >=x11-libs/wxGTK-2.4.2 )
62 #define this to skip building the other daemons ...
63 [ -n "$BUILD_CLIENT_ONLY" ] \
64 && myconf="${myconf} --enable-client-only"
69 `use_enable tcpd tcp-wrappers`
72 [ -n "$BUILD_CLIENT_ONLY" ] \
73 && myconf="${myconf} --enable-client-only"
75 # mysql is the reccomended choice ...
78 myconf="${myconf} --with-mysql=/usr"
81 myconf="${myconf} --with-postgresql=/usr"
84 myconf="${myconf} --with-sqlite=/usr"
85 elif use sqlite && use mysql
87 myconf="${myconf/--with-sqlite/}"
92 myconf="${myconf} --enable-wx-console"
97 myconf="${myconf} --enable-readline"
102 myconf="${myconf} --enable-tray-monitor"
107 --enable-smartalloc \
109 --mandir=/usr/share/man \
110 --with-pid-dir=/var/run \
111 --sysconfdir=/etc/bacula \
112 --infodir=/usr/share/info \
113 --with-subsys-dir=/var/lock/subsys \
114 --with-working-dir=/var/bacula \
115 --with-scriptdir=/etc/bacula \
116 --with-dir-user=root \
117 --with-dir-group=bacula \
118 --with-sd-user=root \
119 --with-sd-group=bacula \
120 --with-fd-user=root \
121 --with-fd-group=bacula \
122 --host=${CHOST} ${myconf} || die "bad ./configure"
124 emake || die "compile problem"
126 # for the rescue package regardless of use static
128 make static-bacula-fd
136 make static-bacula-dir
139 cd ${S}/src/gnome-console
140 make static-gnome-console
144 cd ${S}/src/wx-console
145 make static-wx-console
148 make static-bacula-sd
153 make DESTDIR=${D} install || die
158 cp static-bacula-fd ${D}/usr/sbin/bacula-fd
160 cp static-console ${D}/usr/sbin/console
162 cp static-bacula-dir ${D}/usr/sbin/bacula-dir
165 cd ${S}/src/gnome-console
166 cp static-gnome-console ${D}/usr/sbin/gnome-console
170 cd ${S}/src/wx-console
171 cp static-wx-console ${D}/usr/sbin/wx-console
174 cp static-bacula-sd ${D}/usr/sbin/bacula-sd
180 mkdir -p ${D}/usr/share/pixmaps
181 mkdir -p ${D}/usr/share/applications
182 cp ${S}/scripts/bacula.png ${D}/usr/share/pixmaps/bacula.png
183 cp ${S}/scripts/bacula.desktop.gnome2.xsu ${D}/usr/share/applications/bacula.desktop
184 cp ${S}/src/tray-monitor/generic.xpm ${D}/usr/share/pixmaps/bacula-tray-monitor.xpm
185 cp ${S}/scripts/bacula-tray-monitor.desktop \
186 ${D}/usr/share/applications/bacula-tray-monitor.desktop
187 chmod 755 ${D}/usr/sbin/bacula-tray-monitor
188 chmod 644 ${D}/etc/bacula/tray-monitor.conf
191 # the database update scripts
192 mkdir -p ${D}/etc/bacula/updatedb
193 cp ${S}/updatedb/* ${D}/etc/bacula/updatedb/
194 chmod 754 ${D}/etc/bacula/updatedb/*
196 # the cdrom rescue package
197 mkdir -p ${D}/etc/bacula/rescue/cdrom
198 cp -R ${S}/rescue/linux/cdrom/* ${D}/etc/bacula/rescue/cdrom/
199 mkdir ${D}/etc/bacula/rescue/cdrom/bin
200 cp ${S}/src/filed/static-bacula-fd ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
201 chmod 754 ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
204 for a in ${S}/{Changelog,README,ReleaseNotes,kernstodo,LICENSE,doc/bacula.pdf}
209 dohtml -r ${S}/doc/html-manual doc/home-page
210 chown -R root:root ${D}/usr/share/doc/${PF}
211 chmod -R 644 ${D}/usr/share/doc/${PF}/*
213 # clean up permissions left broken by install
214 chmod o-r ${D}/etc/bacula/query.sql
216 # remove the working dir so we can add it postinst with group
217 rmdir ${D}/var/bacula
219 # this is now in the source package processed by configure
221 newexe ${S}/platforms/gentoo/bacula-init bacula
225 # create the daemon group
226 HAVE_BACULA=`cat /etc/group | grep bacula 2>/dev/null`
227 if [ -z $HAVE_BACULA ]; then
230 einfo "The group bacula has been created. Any users you add to"
231 einfo "this group have access to files created by the daemons."
234 # the working directory
235 install -m0750 -o root -g bacula -d ${ROOT}/var/bacula
237 # link installed bacula-fd.conf into rescue directory
238 ln -s /etc/bacula/bacula-fd.conf /etc/bacula/rescue/cdrom/bacula-fd.conf
241 einfo "The CDRom rescue disk package has been installed into the"
242 einfo "/etc/bacula/rescue/cdrom/ directory. Please examine the manual"
243 einfo "for information on creating a rescue CD."
246 if [ ! $BUILD_CLIENT_ONLY ]; then
248 einfo "Please note either/or nature of database USE flags for"
249 einfo "Bacula. If mysql is set, it will be used, else postgres"
250 einfo "else finally SQLite. If you wish to have multiple DBs on"
251 einfo "one system, you may wish to unset auxillary DBs for this"
257 # test for an existing database
258 # note: this ASSUMES no password has been set for bacula database
259 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
260 if [ -z "$DB_VER" ]; then
261 einfo "This appears to be a new install and you plan to use mysql"
262 einfo "for your catalog database. You should now create it by doing"
263 einfo "these commands:"
264 einfo " sh /etc/bacula/grant_mysql_privileges"
265 einfo " sh /etc/bacula/create_mysql_database"
266 einfo " sh /etc/bacula/make_mysql_tables"
267 elif [ "$DB_VER" -lt "8" ]; then
268 elinfo "This release requires an upgrade to your bacula database"
269 einfo "as the database format has changed. Please read the"
270 einfo "manual chapter for how to upgrade your database!!!"
272 einfo "Backup your database with the command:"
273 einfo " mysqldump -f --opt bacula | bzip2 > /var/bacula/bacula_backup.sql.bz"
275 einfo "Then update your database using the scripts found in"
276 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
277 einfo "version 8. Note that scripts must be run in order from your"
278 einfo "version to the current version."
284 # test for an existing database
285 # note: this ASSUMES no password has been set for bacula database
286 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
287 if [ -z "$DB_VER" ]; then
288 einfo "This appears to be a new install and you plan to use postgresql"
289 einfo "for your catalog database. You should now create it by doing"
290 einfo "these commands:"
291 einfo " sh /etc/bacula/create_postgresql_database"
292 einfo " sh /etc/bacula/make_postgresql_tables"
293 einfo " sh /etc/bacula/grant_postgresql_privileges"
294 elif [ "$DB_VER" -lt "8" ]; then
295 elinfo "This release requires an upgrade to your bacula database"
296 einfo "as the database format has changed. Please read the"
297 einfo "manual chapter for how to upgrade your database!!!"
299 einfo "Backup your database with the command:"
300 einfo " pg_dump bacula | bzip2 > /var/bacula/bacula_backup.sql.bz2"
302 einfo "Then update your database using the scripts found in"
303 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
304 einfo "version 8. Note that scripts must be run in order from your"
305 einfo "version to the current version."
311 # test for an existing database
312 # note: this ASSUMES no password has been set for bacula database
313 DB_VER=`echo "select * from Version;" | sqlite 2>/dev/null /var/bacula/bacula.db | tail -n 1`
314 if [ -z "$DB_VER" ]; then
315 einfo "This appears to be a new install and you plan to use sqlite"
316 einfo "for your catalog database. You should now create it by doing"
317 einfo "these commands:"
318 einfo " sh /etc/bacula/grant_sqlite_privileges"
319 einfo " sh /etc/bacula/create_sqlite_database"
320 einfo " sh /etc/bacula/make_sqlite_tables"
321 elif [ "$DB_VER" -lt "8" ]; then
322 elinfo "This release requires an upgrade to your bacula database"
323 einfo "as the database format has changed. Please read the"
324 einfo "manual chapter for how to upgrade your database!!!"
326 einfo "Backup your database with the command:"
327 einfo " echo .dump | sqlite /var/bacula/bacula.db | bzip2 > \\"
328 einfo " /var/bacula/bacula_backup.sql.bz2"
330 einfo "Then update your database using the scripts found in"
331 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
332 einfo "version 8. Note that scripts must be run in order from your"
333 einfo "version to the current version."
339 einfo "Review your configuration files in /etc/bacula and"
340 if [ $BUILD_CLIENT_ONLY ]; then
341 einfo "since this is a client-only build edit the init"
342 einfo "script /etc/init.d/bacula and comment out the sections"
343 einfo "for the director and storage daemons and then"
345 einfo "start the daemons:"
346 einfo " /etc/init.d/bacula start"
348 einfo "You may also wish to:"
349 einfo " rc-update add bacula default"