summaryrefslogtreecommitdiff
path: root/community/bacula
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-09-24 23:14:35 +0000
committerroot <root@rshg054.dnsready.net>2011-09-24 23:14:35 +0000
commit38a0b12ffffc8842019f47425b60688253e709b0 (patch)
tree73c9939e109bcff426e5d2a91fdd1a7baee2f2d3 /community/bacula
parentcb2a1951e9cd1de18c0ab88c9d741e91a423fc36 (diff)
Sat Sep 24 23:14:35 UTC 2011
Diffstat (limited to 'community/bacula')
-rw-r--r--community/bacula/PKGBUILD68
-rw-r--r--community/bacula/bacula-dir.rc.d41
-rw-r--r--community/bacula/bacula-fd.rc.d41
-rw-r--r--community/bacula/bacula-sd.rc.d41
-rw-r--r--community/bacula/bacula.install49
5 files changed, 240 insertions, 0 deletions
diff --git a/community/bacula/PKGBUILD b/community/bacula/PKGBUILD
new file mode 100644
index 000000000..b48447f75
--- /dev/null
+++ b/community/bacula/PKGBUILD
@@ -0,0 +1,68 @@
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Contributor: Xavion <Xavion (dot) 0 (at) Gmail (dot) com>
+# Contributor: Calogero Lo Leggio <kalos@autistici.org>
+# Contributor: Matias Hernandez <msdark@archlinux.cl>
+
+pkgname=bacula
+pkgver=5.0.3
+pkgrel=5
+pkgdesc="An advanced backup tool with network and tape changer support (MySQL backend)"
+arch=("i686" "x86_64")
+url="http://www.${pkgname}.org"
+license=("GPL")
+depends=("libmysqlclient")
+makedepends=("qt" "wxgtk" "gtk2")
+optdepends=("qt: for bat"
+ "wxgtk: for bwx console"
+ "gtk2: for tray monitor")
+options=(!buildflags)
+conflicts=("${pkgname}-sqlite" "${pkgname}-postgresql" "${pkgname}-client")
+backup=("etc/${pkgname}/bconsole.conf"
+ "etc/${pkgname}/${pkgname}-dir.conf"
+ "etc/${pkgname}/${pkgname}-fd.conf"
+ "etc/${pkgname}/${pkgname}-sd.conf")
+install="${pkgname}.install"
+source=(http://downloads.sourceforge.net/project/bacula/bacula/${pkgver}/${pkgname}-${pkgver}.tar.gz
+ ${pkgname}-sd.rc.d
+ ${pkgname}-fd.rc.d
+ ${pkgname}-dir.rc.d)
+md5sums=('9de254ae39cab0587fdb2f5d8d90b03b'
+ 'e7be4c9fb3c7ce334f9ee24d71652d3e'
+ 'a9a070a862e9cf39ae4bc374409c721d'
+ '55619ae3094c698541a3bfedc87bdb48')
+
+build() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+
+ # Build
+ ./configure --prefix=/usr \
+ --enable-build-dird --enable-build-stored --enable-smartalloc \
+ --enable-bat --enable-tray-monitor --enable-bwx-console \
+ --with-mysql --without-openssl \
+ --with-dir-user=${pkgname} --with-dir-group=${pkgname} \
+ --with-sd-user=${pkgname} --with-sd-group=${pkgname} \
+ --sysconfdir=/etc/${pkgname} --with-scriptdir=/etc/${pkgname}/scripts \
+ --with-working-dir=/var/cache/${pkgname}/working \
+ --with-subsys-dir=/var/cache/${pkgname}/working \
+ --with-archivedir=/var/cache/${pkgname}/archive
+
+ make
+}
+
+package() {
+ cd ${srcdir}/${pkgname}-${pkgver}
+
+ make DESTDIR=${pkgdir} install
+
+ # Permissions
+ chmod a+x ${pkgdir}/etc/${pkgname}/scripts/{update_${pkgname}_tables,delete_catalog_backup,update_mysql_tables,make_catalog_backup,bconsole}
+
+ # Daemons
+ mkdir -p ${pkgdir}/etc/rc.d/
+ install -Dm755 ${srcdir}/*.rc.d ${pkgdir}/etc/rc.d/
+
+ # Logs
+ install -D -m644 ${srcdir}/${pkgname}-${pkgver}/scripts/logrotate ${pkgdir}/etc/logrotate.d/${pkgname}
+ sed -i "s|/var/cache/${pkgname}/working/log|/var/log/${pkgname}.log|g" ${pkgdir}/etc/{${pkgname}/${pkgname}-dir.conf,logrotate.d/${pkgname}}
+}
+
diff --git a/community/bacula/bacula-dir.rc.d b/community/bacula/bacula-dir.rc.d
new file mode 100644
index 000000000..a5a103dca
--- /dev/null
+++ b/community/bacula/bacula-dir.rc.d
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+
+ [ -d /var/run/bacula ] || mkdir -p /var/run/bacula
+ chown bacula:bacula /var/run/bacula
+
+ stat_busy "Starting Bacula Director Daemon"
+ /usr/sbin/bacula-dir
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon bacula-dir
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Bacula Director Daemon"
+ killall bacula-dir > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon bacula-dir
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+~
+~
diff --git a/community/bacula/bacula-fd.rc.d b/community/bacula/bacula-fd.rc.d
new file mode 100644
index 000000000..3817a0fed
--- /dev/null
+++ b/community/bacula/bacula-fd.rc.d
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+
+ [ -d /var/run/bacula ] || mkdir -p /var/run/bacula
+ chown bacula:bacula /var/run/bacula
+
+ stat_busy "Starting Bacula File Daemon"
+ /usr/sbin/bacula-fd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon bacula-fd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Bacula File Daemon"
+ killall bacula-fd > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon bacula-fd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+~
+~
diff --git a/community/bacula/bacula-sd.rc.d b/community/bacula/bacula-sd.rc.d
new file mode 100644
index 000000000..96f200916
--- /dev/null
+++ b/community/bacula/bacula-sd.rc.d
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+
+ [ -d /var/run/bacula ] || mkdir -p /var/run/bacula
+ chown bacula:bacula /var/run/bacula
+
+ stat_busy "Starting Bacula Storage Daemon"
+ /usr/sbin/bacula-sd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon bacula-sd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Bacula Storage Daemon"
+ killall bacula-sd > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon bacula-sd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+~
+~
diff --git a/community/bacula/bacula.install b/community/bacula/bacula.install
new file mode 100644
index 000000000..9b8a3669a
--- /dev/null
+++ b/community/bacula/bacula.install
@@ -0,0 +1,49 @@
+post_install() {
+ if [ -z "`grep '^bacula::' /etc/group`" ]; then
+ echo "Adding bacula system group... "
+ groupadd -g 73 bacula >& /dev/null
+ fi
+
+ if [ -z "`grep '^bacula::' /etc/passwd`" ]; then
+ echo "Adding bacula system user... "
+ useradd -u 73 -c "Bacula Daemon" -d / -g bacula -s /bin/false bacula
+ fi
+
+ echo "Locking Bacula User Account..."
+ passwd -l bacula &>/dev/null
+
+ post_upgrade
+}
+
+post_upgrade() {
+
+cat << EOM
+
+Note:
+==> Please don't forget to config your MySQL database for the program.
+==>
+==> 1. If you have not init your MySQL DB yet, run mysql_install_db.
+==> 2. Run /etc/bacula/scripts/grant_mysql_privileges. This script creates database user
+==> 'bacula' with unrestricted rights to the bacula's database. The
+==> script create user is without any password. You may want to edit
+==> the script before run it.
+==> 3. Run /etc/bacula/scripts/create_mysql_database to create the Database
+==> Bacula.
+==> 4. Run /etc/bacula/scripts/make_mysql_tables to create tables used by bacula.
+
+==> The archive directory is: /var/cache/bacula
+
+==> Bacula's offical website : http://www.bacula.org
+
+EOM
+}
+
+post_remove() {
+ echo "Removing Bacula's system users..."
+ userdel bacula &> /dev/null
+ groupdel bacula &> /dev/null
+}
+
+op=$1
+shift
+[ "$(type -t "$op")" = "function" ] && $op "$@"