From 0e41061d8fc44a7cfcf90f382ad1db993e0fe583 Mon Sep 17 00:00:00 2001 From: Henry Jensen Date: Sun, 31 Jul 2016 07:56:30 +0700 Subject: system/bareos: Added (managed backup and recovery). Signed-off-by: Willy Sudiarto Raharjo --- system/bareos/README | 34 +++++++ system/bareos/README.SLACKWARE | 21 ++++ system/bareos/bareos.SlackBuild | 220 ++++++++++++++++++++++++++++++++++++++++ system/bareos/bareos.info | 10 ++ system/bareos/bareos.png | Bin 0 -> 5740 bytes system/bareos/doinst.sh | 31 ++++++ system/bareos/slack-desc | 19 ++++ 7 files changed, 335 insertions(+) create mode 100644 system/bareos/README create mode 100644 system/bareos/README.SLACKWARE create mode 100644 system/bareos/bareos.SlackBuild create mode 100644 system/bareos/bareos.info create mode 100644 system/bareos/bareos.png create mode 100644 system/bareos/doinst.sh create mode 100644 system/bareos/slack-desc (limited to 'system/bareos') diff --git a/system/bareos/README b/system/bareos/README new file mode 100644 index 0000000000..0ab09857cb --- /dev/null +++ b/system/bareos/README @@ -0,0 +1,34 @@ +Bareos (Manage backup, recovery) - Client and server + +Bareos 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. Bareos 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, +Bareos 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 and sqlite3. +By default mysql is selected, to disable or select another database, run: + + DATABASE="" ./bareos.SlackBuild + +Some say that having everything under /opt/bareos 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 ./bareos.SlackBuild + +will put (almost) everything into /opt/bareos 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 and from Bacula +see README.SLACKWARE that came with this package (which is also installed +with the documentation). diff --git a/system/bareos/README.SLACKWARE b/system/bareos/README.SLACKWARE new file mode 100644 index 0000000000..8024adca15 --- /dev/null +++ b/system/bareos/README.SLACKWARE @@ -0,0 +1,21 @@ +Bareos is a fork from the nackup project Bacula. For the reasons why the +fork was made see https://www.bareos.org/en/faq/why_fork.html + +It is posible to migrate from Bacula 5.x to Bareos. For the migration +of the database there are SQL scripts located at +/var/lib/bareos/scripts/ddl/updates + +You can check the VersionID of your bacula database with the command + + SELECT VersionID from Version; + +Bacula 5.2 has the VersionID 14. To upgrade to Bareois 15.2.x apply the +scripts + + *.14_2001.sql + *.2001_2002.sql + *.2002_2003.sql + *.2003_2004.sql + +top your bacula database. Rename the user "bacula" to "baeros" and adjust +your config files accordingly. \ No newline at end of file diff --git a/system/bareos/bareos.SlackBuild b/system/bareos/bareos.SlackBuild new file mode 100644 index 0000000000..5e32ae968d --- /dev/null +++ b/system/bareos/bareos.SlackBuild @@ -0,0 +1,220 @@ +#!/bin/sh + +# Slackware build script for bareos +# Copyright 2016 Henry Jensen Germany +# based on Slackware build script for bacula +# Copyright 2010, 2012, 2013 Mario Preksavec, Zagreb, HR +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=bareos +VERSION=${VERSION:-15.2.3} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +# E-mail address used for job announcements and core dumps +EMAIL=${EMAIL:-root@localhost} + +# SMTP host for e-mail delivery +SMTPHOST=${SMTPHOST:-localhost} + +# Database support, build with mysql on by default +DATABASE=${DATABASE:-mysql} +case "$DATABASE" in + postgresql) WITH_DATABASE="--with-postgresql" ;; + mysql) WITH_DATABASE="--with-mysql" ;; + sqlite) WITH_DATABASE="--with-sqlite3" ;; + *) WITH_DATABASE="" ;; +esac + +# BAT support, includes a desktop icon +BAT=${BAT:-no} +case "$BAT" in + 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 + LOCALSTATEDIR=/var + SBINDIR=$PREFIX/sbin + VARIABLEDATA=$LOCALSTATEDIR/bareos + ;; + *) PREFIX=/opt/bareos + 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 ^bareos: /etc/passwd 2>&1 > /dev/null; then + +cat << EOF + + You must have a bareos user to run this script + + # groupadd -g 328 bareos + # useradd -u 328 -d /dev/null -s /bin/false -g bareos bareos + +EOF + + exit +elif ! grep ^bareos: /etc/group 2>&1 > /dev/null; then + +cat << EOF + + You must have a bareos group to run this script + + # groupadd -g 328 bareos + +EOF + + exit +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-Release-$VERSION +tar xvf $CWD/$VERSION.tar.gz +cd $PRGNAM-Release-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=$PREFIX \ + --sbindir=$SBINDIR \ + --libdir=$LIBDIR \ + --sysconfdir=$SYSCONFDIR \ + --localstatedir=$LOCALSTATEDIR \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --with-working-dir=/var/lib/bareos \ + --with-pid-dir=/var/lib/bareos \ + --with-bsrdir=/var/lib/bareos \ + --with-scriptdir=/var/lib/bareos/scripts \ + --with-plugindir=/var/lib/bareos/plugins \ + --with-logdir=/var/log/bareos \ + --with-dump-email=$EMAIL \ + --with-job-email=$EMAIL \ + --with-smtp-host=$SMTPHOST \ + --enable-smartalloc \ + --enable-acl \ + --enable-xattr \ + --disable-readline \ + --with-dir-group=bareos \ + --with-dir-user=bareos \ + --with-sd-group=bareos \ + --with-sd-user=bareos \ + --with-fd-user=root \ + --with-fd-group=root \ + --with-openssl \ + $WITH_DATABASE \ + $ENABLE_BAT \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Copy logrotate script, adds bareos user +mkdir -p $PKG/etc/logrotate.d +sed '/^\/.*{$/ s#$#\n su bareos bareos#' scripts/logrotate \ + > $PKG/etc/logrotate.d/bareos.new + +# Copy init script +install -D -m0755 -oroot -groot scripts/bareos $PKG/etc/rc.d/rc.bareos.new + +# Append .new to config files +for i in $PKG/$SYSCONFDIR/bareos/*.conf ; do mv $i $i.new ; done + +# More BAT GUI stuff +case "$BAT" in + yes) install -D -m0644 -oroot -groot $CWD/bareos-bat.desktop \ + $PKG/usr/share/applications/bareos-bat.desktop + install -D -m0644 -oroot -groot $CWD/bareos.png \ + $PKG/usr/share/icons/hicolor/64x64/apps/bareos.png + sed -i "s#%sbindir%#$SBINDIR#" \ + $PKG/usr/share/applications/bareos-bat.desktop + ;; +esac + +# Remove useless tmp dir +rmdir $PKG/tmp + +# Fix some permissions +chown -R bareos:bareos $PKG/etc/bareos $PKG/usr/sbin/* $PKG/var/log/bareos \ + $PKG/var/lib/bareos/{plugins,scripts} + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AGPL-3.0.txt AUTHORS LICENSE README.* $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +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/bareos/bareos.info b/system/bareos/bareos.info new file mode 100644 index 0000000000..f8cc6f48ba --- /dev/null +++ b/system/bareos/bareos.info @@ -0,0 +1,10 @@ +PRGNAM="bareos" +VERSION="15.2.3" +HOMEPAGE="http://www.bareos.org" +DOWNLOAD="https://github.com/bareos/bareos/archive/Release/15.2.3.tar.gz" +MD5SUM="b15872bcda22363ea9a87be7a2e3201a" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Henry Jensen" +EMAIL="hjensen@connochaetos.org" diff --git a/system/bareos/bareos.png b/system/bareos/bareos.png new file mode 100644 index 0000000000..4138bb0867 Binary files /dev/null and b/system/bareos/bareos.png differ diff --git a/system/bareos/doinst.sh b/system/bareos/doinst.sh new file mode 100644 index 0000000000..b97f697e52 --- /dev/null +++ b/system/bareos/doinst.sh @@ -0,0 +1,31 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.bareos.new +config %sysconfdir%/bareos/bareos-dir.conf.new +config %sysconfdir%/bareos/bareos-fd.conf.new +config %sysconfdir%/bareos/bareos-sd.conf.new +config %sysconfdir%/bareos/bconsole.conf.new +config %sysconfdir%/bareos/mtx-changer.conf.new +config etc/logrotate.d/bareos.new diff --git a/system/bareos/slack-desc b/system/bareos/slack-desc new file mode 100644 index 0000000000..20c7210a22 --- /dev/null +++ b/system/bareos/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +bareos: bareos (managed backup and recovery) +bareos: +bareos: bareos is a set of computer programs that permit you (or the system +bareos: administrator) to manage backup, recovery, and verification of +bareos: computer data across a network of computers of different kinds. +bareos: +bareos: Homepage: http://www.bareos.org +bareos: +bareos: +bareos: +bareos: -- cgit v1.2.3