diff options
author | Mario Preksavec <mario@slackware.hr> | 2013-12-20 08:15:19 +0700 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2013-12-25 15:05:36 -0600 |
commit | 43725c3bdbfe35eccad0e9a7925336f57efe3db9 (patch) | |
tree | 0f7b01305b3a26db1e73fda88b4facd5975c0573 /system/bacula/bacula.SlackBuild | |
parent | 95f98b11ddf006c26bb9ecb75a9a9ecbdaae13fb (diff) | |
download | slackbuilds-43725c3bdbfe35eccad0e9a7925336f57efe3db9.tar.gz |
system/bacula: Documentation and script updates.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/bacula/bacula.SlackBuild')
-rw-r--r-- | system/bacula/bacula.SlackBuild | 128 |
1 files changed, 93 insertions, 35 deletions
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} |