1 # Copyright 2004 D. Scott Barninger
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # Modified from bacula-1.34.5.ebuild for 1.36.0 release
5 # 24 Oct 2004 D. Scott Barninger <barninger at fairfieldcomputers dot com>
7 DESCRIPTION="featureful client/server network backup suite"
8 HOMEPAGE="http://www.bacula.org/"
9 SRC_URI="mirror://sourceforge/bacula/${P}.tar.gz"
13 KEYWORDS="~x86 ~ppc ~sparc"
14 IUSE="readline tcpd gnome mysql sqlite X static postgres wxwindows"
18 #theres a local sqlite use flag. use it -OR- mysql, not both.
19 #mysql is the reccomended choice ...
20 #may need sys-libs/libtermcap-compat but try without first
21 DEPEND=">=sys-libs/zlib-1.1.4
23 readline? ( >=sys-libs/readline-4.1 )
24 tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
25 gnome? ( gnome-base/libgnome )
26 gnome? ( app-admin/gnomesu )
27 sqlite? ( =dev-db/sqlite-2* )
28 mysql? ( >=dev-db/mysql-3.23 )
29 postgres? ( >=dev-db/postgresql-7.4.0 )
31 wxwindows? ( >=x11-libs/wxGTK-2.4.2 )
40 # patch configure for scripts/bacula-tray-monitor.desktop
41 patch ${S}/configure ${FILESDIR}/${P}-configure.diff
45 #sed -i -e "s:$bindir/mysql:$bindir/mysql -p:g" grant_mysql_privileges.in
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"
118 make static-bacula-dir
121 cd ${S}/src/gnome-console
122 make static-gnome-console
126 cd ${S}/src/wx-console
127 make static-wx-console
130 make static-bacula-sd
135 make DESTDIR=${D} install || die
140 cp static-bacula-fd ${D}/usr/sbin/bacula-fd
142 cp static-console ${D}/usr/sbin/console
144 cp static-bacula-dir ${D}/usr/sbin/bacula-dir
147 cd ${S}/src/gnome-console
148 cp static-gnome-console ${D}/usr/sbin/gnome-console
152 cd ${S}/src/wx-console
153 cp static-wx-console ${D}/usr/sbin/wx-console
156 cp static-bacula-sd ${D}/usr/sbin/bacula-sd
162 mkdir -p ${D}/usr/share/pixmaps
163 mkdir -p ${D}/usr/share/applications
164 cp ${S}/scripts/bacula.png ${D}/usr/share/pixmaps/bacula.png
165 cp ${S}/scripts/bacula.desktop.gnome2.xsu ${D}/usr/share/applications/bacula.desktop
166 cp ${S}/src/tray-monitor/generic.xpm ${D}/usr/share/pixmaps/bacula-tray-monitor.xpm
167 cp ${S}/scripts/bacula-tray-monitor.desktop \
168 ${D}/usr/share/applications/bacula-tray-monitor.desktop
169 chmod 755 ${D}/usr/sbin/bacula-tray-monitor
170 chmod 644 ${D}/etc/bacula/tray-monitor.conf
173 # the database update scripts
174 mkdir -p ${D}/etc/bacula/updatedb
175 cp ${S}/updatedb/* ${D}/etc/bacula/updatedb/
176 chmod 754 ${D}/etc/bacula/updatedb/*
179 for a in ${S}/{Changelog,README,ReleaseNotes,kernstodo,LICENSE,doc/bacula.pdf}
184 dohtml -r ${S}/doc/html-manual doc/home-page
185 chown -R root:root ${D}/usr/share/doc/${PF}
186 chmod -R 644 ${D}/usr/share/doc/${PF}/*
188 # clean up permissions left broken by install
189 chmod o-r ${D}/etc/bacula/query.sql
191 # remove the working dir so we can add it postinst with group
192 rmdir ${D}/var/bacula
195 newexe ${FILESDIR}/bacula-init bacula
199 # create the daemon group
200 HAVE_BACULA=`cat /etc/group | grep bacula 2>/dev/null`
201 if [ -z $HAVE_BACULA ]; then
204 einfo "The group bacula has been created. Any users you add to"
205 einfo "this group have access to files created by the daemons."
208 # the working directory
209 install -m0750 -o root -g bacula -d ${ROOT}/var/bacula
212 einfo "Please note either/or nature of database USE flags for"
213 einfo "Bacula. If mysql is set, it will be used, else postgresql"
214 einfo "else finally SQLite. If you wish to have multiple DBs on"
215 einfo "one system, you may wish to unset auxillary DBs for this"
221 # test for an existing database
222 # note: this ASSUMES no password has been set for bacula database
223 DB_VER=`mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null`
224 if [ -z "$DB_VER" ]; then
225 einfo "This appears to be a new install and you plan to use mysql"
226 einfo "for your catalog database. You should now create it by doing"
227 einfo "these commands:"
228 einfo " sh /etc/bacula/grant_mysql_privileges"
229 einfo " sh /etc/bacula/create_mysql_database"
230 einfo " sh /etc/bacula/make_mysql_tables"
231 elif [ "$DB_VER" -lt "8" ]; then
232 elinfo "This release requires an upgrade to your bacula database"
233 einfo "as the database format has changed. Please read the"
234 einfo "manual chapter for how to upgrade your database!!!"
236 einfo "Backup your database with the command:"
237 einfo " mysqldump -f --opt bacula | bzip2 > /var/bacula/bacula_backup.sql.bz"
239 einfo "Then update your database using the scripts found in"
240 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
241 einfo "version 8. Note that scripts must be run in order from your"
242 einfo "version to the current version."
248 # test for an existing database
249 # note: this ASSUMES no password has been set for bacula database
250 DB_VER=`echo 'select * from Version;' | psql bacula | tail -3 | head -1 2>/dev/null`
251 if [ -z "$DB_VER" ]; then
252 einfo "This appears to be a new install and you plan to use postgresql"
253 einfo "for your catalog database. You should now create it by doing"
254 einfo "these commands:"
255 einfo " sh /etc/bacula/grant_postgresql_privileges"
256 einfo " sh /etc/bacula/create_postgresql_database"
257 einfo " sh /etc/bacula/make_postgresql_tables"
258 elif [ "$DB_VER" -lt "8" ]; then
259 elinfo "This release requires an upgrade to your bacula database"
260 einfo "as the database format has changed. Please read the"
261 einfo "manual chapter for how to upgrade your database!!!"
263 einfo "Backup your database with the command:"
264 einfo " pg_dump bacula | bzip2 > /var/bacula/bacula_backup.sql.bz2"
266 einfo "Then update your database using the scripts found in"
267 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
268 einfo "version 8. Note that scripts must be run in order from your"
269 einfo "version to the current version."
275 # test for an existing database
276 # note: this ASSUMES no password has been set for bacula database
277 DB_VER=`echo "select * from Version;" | sqlite /var/bacula/bacula.db | tail -n 1 2>/dev/null`
278 if [ -z "$DB_VER" ]; then
279 einfo "This appears to be a new install and you plan to use sqlite"
280 einfo "for your catalog database. You should now create it by doing"
281 einfo "these commands:"
282 einfo " sh /etc/bacula/grant_sqlite_privileges"
283 einfo " sh /etc/bacula/create_sqlite_database"
284 einfo " sh /etc/bacula/make_sqlite_tables"
285 elif [ "$DB_VER" -lt "8" ]; then
286 elinfo "This release requires an upgrade to your bacula database"
287 einfo "as the database format has changed. Please read the"
288 einfo "manual chapter for how to upgrade your database!!!"
290 einfo "Backup your database with the command:"
291 einfo " echo .dump | sqlite /var/bacula/bacula.db | bzip2 > \"
292 einfo " /var/bacula/bacula_backup.sql.bz2"
294 einfo "Then update your database using the scripts found in"
295 einfo "/etc/bacula/updatedb/ from your current version $DB_VER to"
296 einfo "version 8. Note that scripts must be run in order from your"
297 einfo "version to the current version."
302 einfo "Then setup your configuration files in /etc/bacula and"
303 einfo "start the daemons:"
304 einfo " /etc/init.d/bacula start"
306 einfo "You may also wish to:"
307 einfo " rc-update add bacula default"