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 DESCRIPTION="featureful client/server network backup suite"
13 HOMEPAGE="http://www.bacula.org/"
14 SRC_URI="mirror://sourceforge/bacula/${P}.tar.gz"
18 KEYWORDS="~x86 ~ppc ~sparc"
19 IUSE="readline tcpd gnome mysql sqlite X static postgres wxwindows"
23 #theres a local sqlite use flag. use it -OR- mysql, not both.
24 #mysql is the recommended choice ...
25 #may need sys-libs/libtermcap-compat but try without first
26 DEPEND=">=sys-libs/zlib-1.1.4
28 readline? ( >=sys-libs/readline-4.1 )
29 tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
30 gnome? ( gnome-base/libgnome )
31 gnome? ( app-admin/gnomesu )
32 sqlite? ( =dev-db/sqlite-2* )
33 mysql? ( >=dev-db/mysql-3.23 )
34 postgres? ( >=dev-db/postgresql-7.4.0 )
36 wxwindows? ( >=x11-libs/wxGTK-2.4.2 )
47 #define this to skip building the other daemons ...
48 [ -n "$BUILD_CLIENT_ONLY" ] \
49 && myconf="${myconf} --enable-client-only"
54 `use_enable tcpd tcp-wrappers`
57 [ -n "$BUILD_CLIENT_ONLY" ] \
58 && myconf="${myconf} --enable-client-only"
60 # mysql is the reccomended choice ...
63 myconf="${myconf} --with-mysql=/usr"
66 myconf="${myconf} --with-postgresql=/usr"
69 myconf="${myconf} --with-sqlite=/usr"
70 elif use sqlite && use mysql
72 myconf="${myconf/--with-sqlite/}"
77 myconf="${myconf} --enable-wx-console"
82 myconf="${myconf} --enable-readline"
87 myconf="${myconf} --enable-tray-monitor"
94 --mandir=/usr/share/man \
95 --with-pid-dir=/var/run \
96 --sysconfdir=/etc/bacula \
97 --infodir=/usr/share/info \
98 --with-subsys-dir=/var/lock/subsys \
99 --with-working-dir=/var/bacula \
100 --with-scriptdir=/etc/bacula \
101 --with-dir-user=root \
102 --with-dir-group=bacula \
103 --with-sd-user=root \
104 --with-sd-group=bacula \
105 --with-fd-user=root \
106 --with-fd-group=bacula \
107 --host=${CHOST} ${myconf} || die "bad ./configure"
109 emake || die "compile problem"
111 # for the rescue package regardless of use static
113 make static-bacula-fd
121 make static-bacula-dir
124 cd ${S}/src/gnome-console
125 make static-gnome-console
129 cd ${S}/src/wx-console
130 make static-wx-console
133 make static-bacula-sd
138 make DESTDIR=${D} install || die
143 cp static-bacula-fd ${D}/usr/sbin/bacula-fd
145 cp static-console ${D}/usr/sbin/console
147 cp static-bacula-dir ${D}/usr/sbin/bacula-dir
150 cd ${S}/src/gnome-console
151 cp static-gnome-console ${D}/usr/sbin/gnome-console
155 cd ${S}/src/wx-console
156 cp static-wx-console ${D}/usr/sbin/wx-console
159 cp static-bacula-sd ${D}/usr/sbin/bacula-sd
165 mkdir -p ${D}/usr/share/pixmaps
166 mkdir -p ${D}/usr/share/applications
167 cp ${S}/scripts/bacula.png ${D}/usr/share/pixmaps/bacula.png
168 cp ${S}/scripts/bacula.desktop.gnome2.xsu ${D}/usr/share/applications/bacula.desktop
169 cp ${S}/src/tray-monitor/generic.xpm ${D}/usr/share/pixmaps/bacula-tray-monitor.xpm
170 cp ${S}/scripts/bacula-tray-monitor.desktop \
171 ${D}/usr/share/applications/bacula-tray-monitor.desktop
172 chmod 755 ${D}/usr/sbin/bacula-tray-monitor
173 chmod 644 ${D}/etc/bacula/tray-monitor.conf
176 # the database update scripts
177 mkdir -p ${D}/etc/bacula/updatedb
178 cp ${S}/updatedb/* ${D}/etc/bacula/updatedb/
179 chmod 754 ${D}/etc/bacula/updatedb/*
181 # the cdrom rescue package
182 mkdir -p ${D}/etc/bacula/rescue/cdrom
183 cp -R ${S}/rescue/linux/cdrom/* ${D}/etc/bacula/rescue/cdrom/
184 mkdir ${D}/etc/bacula/rescue/cdrom/bin
185 cp ${S}/src/filed/static-bacula-fd ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
186 chmod 754 ${D}/etc/bacula/rescue/cdrom/bin/bacula-fd
189 for a in ${S}/{Changelog,README,ReleaseNotes,kernstodo,LICENSE,doc/bacula.pdf}
194 dohtml -r ${S}/doc/html-manual doc/home-page
195 chown -R root:root ${D}/usr/share/doc/${PF}
196 chmod -R 644 ${D}/usr/share/doc/${PF}/*
198 # clean up permissions left broken by install
199 chmod o-r ${D}/etc/bacula/query.sql
201 # remove the working dir so we can add it postinst with group
202 rmdir ${D}/var/bacula
204 # this is now in the source package processed by configure
206 newexe ${S}/platforms/gentoo/bacula-init bacula
210 # create the daemon group
211 HAVE_BACULA=`cat /etc/group | grep bacula 2>/dev/null`
212 if [ -z $HAVE_BACULA ]; then
215 einfo "The group bacula has been created. Any users you add to"
216 einfo "this group have access to files created by the daemons."
219 # the working directory
220 install -m0750 -o root -g bacula -d ${ROOT}/var/bacula
222 # link installed bacula-fd.conf into rescue directory
223 ln -s /etc/bacula/rescue/cdrom/bacula-fd.conf /etc/bacula/bacula-fd.conf
226 einfo "The CDRom rescue disk package has been installed into the"
227 einfo "/etc/bacula/rescue/cdrom/ directory. Please examine the manual"
228 einfo "for information on creating a rescue CD."
232 einfo "Please note either/or nature of database USE flags for"
233 einfo "Bacula. If mysql is set, it will be used, else postgres"
234 einfo "else finally SQLite. If you wish to have multiple DBs on"
235 einfo "one system, you may wish to unset auxillary DBs for this"
241 # test for an existing database
242 # note: this ASSUMES no password has been set for bacula database
243 DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
244 if [ -z "$DB_VER" ]; then
245 einfo "This appears to be a new install and you plan to use mysql"
246 einfo "for your catalog database. You should now create it by doing"
247 einfo "these commands:"
248 einfo " sh /etc/bacula/grant_mysql_privileges"
249 einfo " sh /etc/bacula/create_mysql_database"
250 einfo " sh /etc/bacula/make_mysql_tables"
251 elif [ "$DB_VER" -lt "8" ]; then
252 elinfo "This release requires an upgrade to your bacula database"
253 einfo "as the database format has changed. Please read the"
254 einfo "manual chapter for how to upgrade your database!!!"
256 einfo "Backup your database with the command:"
257 einfo " mysqldump -f --opt bacula | bzip2 > /var/bacula/bacula_backup.sql.bz"
259 einfo "Then update your database using the scripts found in"
260 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
261 einfo "version 8. Note that scripts must be run in order from your"
262 einfo "version to the current version."
268 # test for an existing database
269 # note: this ASSUMES no password has been set for bacula database
270 DB_VER=`echo 'select * from Version;' | psql bacula 2>/dev/null | tail -3 | head -1`
271 if [ -z "$DB_VER" ]; then
272 einfo "This appears to be a new install and you plan to use postgresql"
273 einfo "for your catalog database. You should now create it by doing"
274 einfo "these commands:"
275 einfo " sh /etc/bacula/create_postgresql_database"
276 einfo " sh /etc/bacula/make_postgresql_tables"
277 einfo " sh /etc/bacula/grant_postgresql_privileges"
278 elif [ "$DB_VER" -lt "8" ]; then
279 elinfo "This release requires an upgrade to your bacula database"
280 einfo "as the database format has changed. Please read the"
281 einfo "manual chapter for how to upgrade your database!!!"
283 einfo "Backup your database with the command:"
284 einfo " pg_dump bacula | bzip2 > /var/bacula/bacula_backup.sql.bz2"
286 einfo "Then update your database using the scripts found in"
287 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
288 einfo "version 8. Note that scripts must be run in order from your"
289 einfo "version to the current version."
295 # test for an existing database
296 # note: this ASSUMES no password has been set for bacula database
297 DB_VER=`echo "select * from Version;" | sqlite 2>/dev/null /var/bacula/bacula.db | tail -n 1`
298 if [ -z "$DB_VER" ]; then
299 einfo "This appears to be a new install and you plan to use sqlite"
300 einfo "for your catalog database. You should now create it by doing"
301 einfo "these commands:"
302 einfo " sh /etc/bacula/grant_sqlite_privileges"
303 einfo " sh /etc/bacula/create_sqlite_database"
304 einfo " sh /etc/bacula/make_sqlite_tables"
305 elif [ "$DB_VER" -lt "8" ]; then
306 elinfo "This release requires an upgrade to your bacula database"
307 einfo "as the database format has changed. Please read the"
308 einfo "manual chapter for how to upgrade your database!!!"
310 einfo "Backup your database with the command:"
311 einfo " echo .dump | sqlite /var/bacula/bacula.db | bzip2 > \\"
312 einfo " /var/bacula/bacula_backup.sql.bz2"
314 einfo "Then update your database using the scripts found in"
315 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
316 einfo "version 8. Note that scripts must be run in order from your"
317 einfo "version to the current version."
322 einfo "Review your configuration files in /etc/bacula and"
323 einfo "start the daemons:"
324 einfo " /etc/init.d/bacula start"
326 einfo "You may also wish to:"
327 einfo " rc-update add bacula default"