diff options
-rw-r--r-- | system/bacula/README | 40 | ||||
-rw-r--r-- | system/bacula/bacula-bat.desktop | 11 | ||||
-rw-r--r-- | system/bacula/bacula.SlackBuild | 128 | ||||
-rw-r--r-- | system/bacula/bacula.info | 4 | ||||
-rw-r--r-- | system/bacula/doinst.sh | 9 |
5 files changed, 137 insertions, 55 deletions
diff --git a/system/bacula/README b/system/bacula/README index 6404ead0bb..aa00642162 100644 --- a/system/bacula/README +++ b/system/bacula/README @@ -1,21 +1,33 @@ Bacula (Manage backup, recovery) - Client and server -Bacula is a set of computer programs that permit you (or the system admin) to -manage backup, recovery, and verification of computer data across a network -of computers of different kinds. In technical terms, it is a network -Client/Server based backup program. Bacula is relatively easy to use and -efficient, while offering many advanced storage management features that make -it easy to find and recover lost or damaged files. Due to its modular design, -Bacula is scalable from small single computer systems to systems consisting +Bacula is a set of computer programs that permit you (or the system admin) to +manage backup, recovery, and verification of computer data across a network +of computers of different kinds. In technical terms, it is a network +Client/Server based backup program. Bacula is relatively easy to use and +efficient, while offering many advanced storage management features that make +it easy to find and recover lost or damaged files. Due to its modular design, +Bacula is scalable from small single computer systems to systems consisting of hundreds of computers located over a large network. -This script comes with a few options that can be set at build time, one -of which is DATABASE. Supported databases include postgresql/mysql/sqlite3. -By default mysql support is selected, to disable or select another database -the following can be used: DATABASE="" ./bacula.SlackBuild -One more option worth mentioning is BAT, which can be used to enable building -of Bat together with Bacula. By default Bat comes disabled and for now it -only builds on slackware-current because it requires newer QT. +This script comes with a few options that can be set at build time, one of +which is DATABASE. Supported databases include postgresql, mysql and sqlite3. +By default mysql is selected, to disable or select another database, run: + + DATABASE="" ./bacula.SlackBuild + +Some say that having everything under /opt/bacula can be more backup friendly +for disaster recovery situations, and since the official documentation also +mentions this prefix in quite a few places, running the script with: + + OPT_PREFIX=yes ./bacula.SlackBuild + +will put (almost) everything into /opt/bacula directory. + +Another option worth mentioning is Bat, which by default comes disabled, and +if enabled with BAT=yes variable, creates a package with desktop entries. +Additionally, smtp delivery agent is assumed running on localhost, and job +announcements and core dumps are sent to root@localhost email address. Both +can be changed with EMAIL and SMTPHOST variables. For more information on upgrading from previous version see README.SLACKWARE that came with this package (which is also installed with the documentation). diff --git a/system/bacula/bacula-bat.desktop b/system/bacula/bacula-bat.desktop new file mode 100644 index 0000000000..d0ab5d7051 --- /dev/null +++ b/system/bacula/bacula-bat.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Encoding=UTF-8 +Name=Bacula Bat Console +GenericName=Backup Management Console +Comment=Control your Bacula Server +Exec=%sbindir%/bat +Icon=/usr/share/icons/hicolor/64x64/apps/bacula.png +Terminal=false +Type=Application +Categories=System;Application;Utility diff --git a/system/bacula/bacula.SlackBuild b/system/bacula/bacula.SlackBuild index 6ad22e850e..7fa3e1255a 100644 --- a/system/bacula/bacula.SlackBuild +++ b/system/bacula/bacula.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for Bacula -# Copyright 2010-2013, mario <mario@slackverse.org> +# Copyright 2010, 2012, 2013 Mario Preksavec, Zagreb, HR # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -24,7 +24,7 @@ PRGNAM=bacula VERSION=${VERSION:-5.2.13} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -54,30 +54,75 @@ else LIBDIRSUFFIX="" fi -# E-mail address for bacula to deliver job announcements and core dumps to +# E-mail address used for job announcements and core dumps EMAIL=${EMAIL:-root@localhost} -# SMTP host for mail delivery +# SMTP host for e-mail delivery SMTPHOST=${SMTPHOST:-localhost} -# Build with mysql database by default, supported: postgresql/mysql/sqlite3 +# Database support, build with mysql on by default DATABASE=${DATABASE:-mysql} case "$DATABASE" in - postgresql) DATABASE="--with-postgresql" ;; - mysql) DATABASE="--with-mysql" ;; - sqlite) DATABASE="--with-sqlite3" ;; - *) DATABASE="" ;; + postgresql) WITH_DATABASE="--with-postgresql" ;; + mysql) WITH_DATABASE="--with-mysql" ;; + sqlite) WITH_DATABASE="--with-sqlite3" ;; + *) WITH_DATABASE="" ;; esac -# Let people build with BAT support, which also requires Qt4 version 4.6.2 +# BAT support, includes a desktop icon BAT=${BAT:-no} case "$BAT" in - yes) BAT="--enable-bat" ;; - *) BAT="" ;; + yes) ENABLE_BAT="--enable-bat" ;; + *) ENABLE_BAT="" ;; +esac + +# User might want a portable install +OPT_PREFIX=${OPT_PREFIX:-no} +case "$OPT_PREFIX" in + no) PREFIX=/usr + LIBDIR=$PREFIX/lib${LIBDIRSUFFIX} + SYSCONFDIR=/etc/bacula + LOCALSTATEDIR=/var + SBINDIR=$PREFIX/sbin + VARIABLEDATA=$LOCALSTATEDIR/bacula + ;; + *) PREFIX=/opt/bacula + LIBDIR=$PREFIX/lib + SYSCONFDIR=$PREFIX/etc + SBINDIR=$PREFIX/bin + LOCALSTATEDIR=$PREFIX/var + VARIABLEDATA=$PREFIX + ;; esac set -e +# Bail if user or group isn't valid on your system +if ! grep ^bacula: /etc/passwd 2>&1 > /dev/null; then + +cat << EOF + + You must have a bacula user to run this script + + # groupadd -g 268 bacula + # useradd -u 268 -d /dev/null -s /bin/false -g bacula bacula + +EOF + + exit +elif ! grep ^bacula: /etc/group 2>&1 > /dev/null; then + +cat << EOF + + You must have a bacula group to run this script + + # groupadd -g 268 bacula + +EOF + + exit +fi + rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP @@ -94,53 +139,65 @@ find -L . \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ - --prefix=/usr \ - --libdir=/usr/lib${LIBDIRSUFFIX} \ - --sysconfdir=/etc/bacula \ - --localstatedir=/var \ + --prefix=$PREFIX \ + --sbindir=$SBINDIR \ + --libdir=$LIBDIR \ + --sysconfdir=$SYSCONFDIR \ + --localstatedir=$LOCALSTATEDIR \ --mandir=/usr/man \ --docdir=/usr/doc/$PRGNAM-$VERSION \ - --with-scriptdir=/usr/bin \ - --with-working-dir=/var/bacula/working \ + --with-working-dir=$VARIABLEDATA/working \ + --with-scriptdir=$VARIABLEDATA/scripts \ + --with-logdir=$VARIABLEDATA/working \ + --with-plugindir=$VARIABLEDATA/plugins \ --with-dump-email=$EMAIL \ --with-job-email=$EMAIL \ --with-smtp-host=$SMTPHOST \ + --enable-smartalloc \ --disable-readline \ - $DATABASE \ - $BAT \ + --with-dir-group=bacula \ + --with-dir-user=bacula \ + --with-sd-group=bacula \ + --with-sd-user=bacula \ + $WITH_DATABASE \ + $ENABLE_BAT \ --build=$ARCH-slackware-linux -# Todo: prefix, user and group -# --sbindir=$PREFIX/bin \ -# --with-pid-dir=$PREFIX/working \ -# --with-plugindir=$PREFIX/plugins \ -# --with-scriptdir=$PREFIX/scripts \ -# --with-subsys-dir=$PREFIX/working \ -# --with-working-dir=$PREFIX/working \ -# --with-dir-user=bacula \ -# --with-sd-user=bacula \ -# --with-dir-group=bacula \ -# --with-sd-group=bacula \ - make make install DESTDIR=$PKG find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -# Copy logrotate script +# Copy logrotate script, adds bacula user mkdir -p $PKG/etc/logrotate.d -cat scripts/logrotate > $PKG/etc/logrotate.d/bacula.new +sed '/^\/.*{$/ s#$#\n su bacula bacula#' scripts/logrotate \ + > $PKG/etc/logrotate.d/bacula.new # Copy init script install -D -m0755 -oroot -groot scripts/bacula $PKG/etc/rc.d/rc.bacula.new # Append .new to config files -for i in $PKG/etc/bacula/*.conf ; do mv $i $i.new ; done +for i in $PKG/$SYSCONFDIR/*.conf ; do mv $i $i.new ; done + +# More BAT GUI stuff +case "$BAT" in + yes) install -D -m0644 -oroot -groot $CWD/bacula-bat.desktop \ + $PKG/usr/share/applications/bacula-bat.desktop + install -D -m0644 -oroot -groot $CWD/bacula.png \ + $PKG/usr/share/icons/hicolor/64x64/apps/bacula.png + sed -i "s#%sbindir%#$SBINDIR#" \ + $PKG/usr/share/applications/bacula-bat.desktop + ;; +esac # Remove useless tmp dir rmdir $PKG/tmp +# Fix some permissions +chown -R bacula:bacula $PKG/$SYSCONFDIR/* $PKG/$SBINDIR/* \ + $PKG/$VARIABLEDATA/{plugins,scripts} + mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ ChangeLog COPYING INSTALL README ReleaseNotes VERIFYING \ @@ -151,6 +208,7 @@ cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh +sed -i "s#%sysconfdir%#$SYSCONFDIR#g" $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/bacula/bacula.info b/system/bacula/bacula.info index 4d9b737fa0..81393aab7d 100644 --- a/system/bacula/bacula.info +++ b/system/bacula/bacula.info @@ -6,5 +6,5 @@ MD5SUM="43417bae0c221afb1f30a581c9e0f2fe" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="mario" -EMAIL="mario@slackverse.org" +MAINTAINER="Mario Preksavec" +EMAIL="mario at slackware dot hr" diff --git a/system/bacula/doinst.sh b/system/bacula/doinst.sh index d2acda4c49..56f837c887 100644 --- a/system/bacula/doinst.sh +++ b/system/bacula/doinst.sh @@ -22,10 +22,11 @@ preserve_perms() { config $NEW } + preserve_perms etc/rc.d/rc.bacula.new -config etc/bacula/bacula-dir.conf.new -config etc/bacula/bacula-fd.conf.new -config etc/bacula/bacula-sd.conf.new -config etc/bacula/bconsole.conf.new +config %sysconfdir%/bacula-dir.conf.new +config %sysconfdir%/bacula-fd.conf.new +config %sysconfdir%/bacula-sd.conf.new +config %sysconfdir%/bconsole.conf.new config etc/logrotate.d/bacula.new |