summaryrefslogtreecommitdiffstats
path: root/sysutils/bacula
diff options
context:
space:
mode:
authorlkoeller <lkoeller@FreeBSD.org>2004-01-05 19:25:01 +0000
committerlkoeller <lkoeller@FreeBSD.org>2004-01-05 19:25:01 +0000
commit6376205fed272c10fa277843cacfb6273a875092 (patch)
tree93574c7f44f283713530c74b4a4ead55ad6d3db6 /sysutils/bacula
parent0958b302c75a7fd81fae96b69374e6fdac012f61 (diff)
downloadFreeBSD-ports-6376205fed272c10fa277843cacfb6273a875092.zip
FreeBSD-ports-6376205fed272c10fa277843cacfb6273a875092.tar.gz
o) Upgrade to version 1.32f
o) Now bacula runs with dropped down permissions as user bacula -> Please reserve UID 910 for this user
Diffstat (limited to 'sysutils/bacula')
-rw-r--r--sysutils/bacula/Makefile48
-rw-r--r--sysutils/bacula/distinfo2
-rw-r--r--sysutils/bacula/files/chio-bacula18
-rw-r--r--sysutils/bacula/files/patch-configure25
-rw-r--r--sysutils/bacula/files/patch-dird.c14
-rw-r--r--sysutils/bacula/files/patch-filed.c15
-rw-r--r--sysutils/bacula/files/patch-scripts-fd.in21
-rw-r--r--sysutils/bacula/files/patch-stored.c14
-rw-r--r--sysutils/bacula/pkg-install48
9 files changed, 172 insertions, 33 deletions
diff --git a/sysutils/bacula/Makefile b/sysutils/bacula/Makefile
index 8b81acd..8c0265b 100644
--- a/sysutils/bacula/Makefile
+++ b/sysutils/bacula/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= bacula
-PORTVERSION= 1.32c
+PORTVERSION= 1.32f
#PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
@@ -15,11 +15,23 @@ MASTER_SITE_SUBDIR= bacula
MAINTAINER= Lars.Koeller@Uni-Bielefeld.DE
COMMENT= The network backup solution
+# The user/group IDs below are registered, see
+# http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html#DADS-UID
+#
+BACULA_DIR=/var/db/bacula
+#
USE_REINPLACE= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-tcp-wrappers=/usr/lib \
--enable-smartalloc \
- --with-working-dir=/var/db/bacula
+ --with-working-dir=${BACULA_DIR} \
+ --with-fd-user=root \
+ --with-fd-group=wheel \
+ --with-dir-user=bacula \
+ --with-dir-group=bacula \
+ --with-sd-user=bacula \
+ --with-sd-group=operator
+
CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}"
@@ -49,12 +61,12 @@ pre-everything::
.if !defined(WITH_CLIENT_ONLY)
@${ECHO_MSG} "=======> ATTENTION <======="
@${ECHO_MSG} "===> Note that there is a pthreads problem, which leads to the loss of 500kB"
- @${ECHO_MSG} "===> of data at the end of an tape. This is corrected in the upcoming"
+ @${ECHO_MSG} "===> of data at the end of an tape. This is corrected in FreeBSD"
@${ECHO_MSG} "===> 4.9-RELEASE and 5.2-RELEASE or use the -stable or -current tree."
@${ECHO_MSG} ""
@${ECHO_MSG} "You may use the following build options:"
@${ECHO_MSG} ""
- @${ECHO_MSG} " WITH_CLIENT_ONLY=yes if you only want the file daemon."
+ @${ECHO_MSG} " WITH_CLIENT_ONLY=yes if you only want the file daemon."
.if !defined(WITH_MYSQL)
@${ECHO_MSG} " WITH_MYSQL=yes if you want MySQL instead of SqLite as the database."
.else
@@ -69,6 +81,12 @@ pre-everything::
post-patch:
@${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_CFLAGS}|g' ${WRKSRC}/configure
+pre-install:
+.if !defined(WITH_CLIENT_ONLY)
+ @ ${SETENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
+.endif
+
post-install:
.if defined(WITH_CLIENT_ONLY)
# don't know how to make it better
@@ -87,6 +105,9 @@ post-install:
elif [ -f ${PREFIX}/etc/console.conf ]; then \
${ECHO_CMD} "etc/console.conf" >> ${TMPPLIST}; \
fi
+ # chmod of smtp program so bacula can use it with dropped down permissions
+ ${CHMOD} o+x ${PREFIX}/sbin/smtp
+ ${CHOWN} -R bacula:bacula ${PREFIX}/share/bacula
.endif
# Install leaves existing conf files untouched. Respect this here!
for na in sd fd dir; do \
@@ -104,7 +125,7 @@ post-install:
cpio -pdm -L -R root:wheel ${DOCSDIR}
.endif
-# Inform user when full build takes place about
+# Inform user afer install about important things ....
.if !defined(WITH_CLIENT_ONLY)
@${ECHO_MSG} "*******************************************************"
@${ECHO_MSG} "NOTE:"
@@ -119,6 +140,23 @@ post-install:
@${ECHO_MSG} ""
@${ECHO_MSG} " ${PREFIX}/etc/bacula-dir.conf"
@${ECHO_MSG} ""
+ @${ECHO_MSG} "Take care of correct permissions for changer and"
+ @${ECHO_MSG} "tape device (e.g. /dev/ch0 and /dev/n[r]sa0) i.e."
+ @${ECHO_MSG} "they must be accesable by user bacula."
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "Due to lack of some features in the FreeBSD tape driver"
+ @${ECHO_MSG} "implemtation you MUST add some OS dependent options to"
+ @${ECHO_MSG} "the bacula-sd.conf file:"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} " Backward Space Record = no;"
+ @${ECHO_MSG} " Hardware End of Medium = no;"
+ @${ECHO_MSG} " Fast Forward Space File = no;"
+ @${ECHO_MSG} " BSF at EOM = yes;"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "It is also important that all the scripts accessed"
+ @${ECHO_MSG} "by RunBeforeJob and RunAfterJob could be executed by"
+ @${ECHO_MSG} "the user bacula, too."
+ @${ECHO_MSG} ""
@${ECHO_MSG} "*******************************************************"
.endif
diff --git a/sysutils/bacula/distinfo b/sysutils/bacula/distinfo
index 45c9269..291b1c2 100644
--- a/sysutils/bacula/distinfo
+++ b/sysutils/bacula/distinfo
@@ -1 +1 @@
-MD5 (bacula-1.32c.tar.gz) = 21552bc5c7d006d45007e8424f5560e6
+MD5 (bacula-1.32f.tar.gz) = 2c635cf693262fc946eb13aa271e0263
diff --git a/sysutils/bacula/files/chio-bacula b/sysutils/bacula/files/chio-bacula
index dd6b9e8..d832c19 100644
--- a/sysutils/bacula/files/chio-bacula
+++ b/sysutils/bacula/files/chio-bacula
@@ -33,7 +33,7 @@ BARCODE_FILE=/usr/local/etc/bacula-barcodes
me=$(basename $0)
# Debug
-echo "$me $@" > /dev/console
+logger -p user.err "$me $@"
if [ -z "$1" ] ; then
usage;
@@ -58,7 +58,7 @@ fi
# Time to wait for loading
SLEEP=20
# What drive of the autochanger should be used primary
-# At the moment bacula (1.31a) could not deal with more drives
+# At the moment bacula (1.31a) could not deal with more than one drive
DRIVE=1
usage()
@@ -90,9 +90,15 @@ usage()
case ${COMMAND} in
unload)
# enable the following line if you need to eject the cartridge
- #mt -f ${TAPE} off
- #sleep 2
+ mt -f ${TAPE} off
+ sleep 2
${MTX} -f ${CHANGER} return drive ${DRIVE}
+ # If the changer is power cycled with a tape loaded in a drive
+ if [ "$?" != "0" ]; then
+ free_slot=`${MTX} -f ${CHANGER} stat | grep "^slot " | grep -v "FULL" | awk '{print $2}'`
+ free_slot=${free_slot%:}
+ ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot
+ fi
;;
load)
@@ -121,8 +127,8 @@ case ${COMMAND} in
# echo "Request loaded"
${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$
rtn=$?
- cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: <FULL>" | awk '{print $6+1}' | tr -d ">"
- cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: source: <>" | awk "{print 0}"
+ cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: <FULL> .*slot" | awk '{print $6+1}' | tr -d ">"
+ cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: .* source: <>" | awk "{print 0}"
rm -f /tmp/mtx.$$
exit $rtn
;;
diff --git a/sysutils/bacula/files/patch-configure b/sysutils/bacula/files/patch-configure
new file mode 100644
index 0000000..96fc462
--- /dev/null
+++ b/sysutils/bacula/files/patch-configure
@@ -0,0 +1,25 @@
+*** configure.org Thu Jan 1 18:52:12 2004
+--- configure Thu Jan 1 18:52:33 2004
+***************
+*** 19029,19038 ****
+
+ Director User: ${dir_user}
+ Director Group: ${dir_group}
+! Storage Daemon User: ${dir_user}
+! Storage DaemonGroup: ${dir_group}
+! File Daemon User: ${dir_user}
+! File Daemon Group: ${dir_group}
+
+ SQL binaries Directory ${SQL_BINDIR}
+
+--- 19029,19038 ----
+
+ Director User: ${dir_user}
+ Director Group: ${dir_group}
+! Storage Daemon User: ${sd_user}
+! Storage DaemonGroup: ${sd_group}
+! File Daemon User: ${fd_user}
+! File Daemon Group: ${fd_group}
+
+ SQL binaries Directory ${SQL_BINDIR}
+
diff --git a/sysutils/bacula/files/patch-dird.c b/sysutils/bacula/files/patch-dird.c
new file mode 100644
index 0000000..bd5efe3
--- /dev/null
+++ b/sysutils/bacula/files/patch-dird.c
@@ -0,0 +1,14 @@
+--- src/dird/dird.c 27 Dec 2003 13:14:12 -0000 1.41
++++ src/dird/dird.c 2 Jan 2004 17:21:21 -0000 1.42
+@@ -197,10 +197,10 @@
+ init_stack_dump(); /* grab new pid */
+ }
+
+- drop(uid, gid); /* reduce priveleges if requested */
+-
+ /* Create pid must come after we are a daemon -- so we have our final pid */
+ create_pid_file(director->pid_directory, "bacula-dir", director->DIRport);
++
++ drop(uid, gid); /* reduce priveleges if requested */
+
+ /* signal(SIGHUP, reload_config); */
diff --git a/sysutils/bacula/files/patch-filed.c b/sysutils/bacula/files/patch-filed.c
new file mode 100644
index 0000000..d52d994
--- /dev/null
+++ b/sysutils/bacula/files/patch-filed.c
@@ -0,0 +1,15 @@
+--- src/filed/filed.c 23 Dec 2003 20:23:15 -0000 1.21
++++ src/filed/filed.c 2 Jan 2004 17:21:21 -0000 1.22
+@@ -211,10 +211,10 @@
+ init_stack_dump(); /* set new pid */
+ }
+
+- drop(uid, gid);
+-
+ /* Maximum 1 daemon at a time */
+ create_pid_file(me->pid_directory, "bacula-fd", me->FDport);
++
++ drop(uid, gid);
+
+ #ifdef BOMB
+ me += 1000000;
diff --git a/sysutils/bacula/files/patch-scripts-fd.in b/sysutils/bacula/files/patch-scripts-fd.in
deleted file mode 100644
index 6252554..0000000
--- a/sysutils/bacula/files/patch-scripts-fd.in
+++ /dev/null
@@ -1,21 +0,0 @@
-*** scripts/fd.in.orig Sun May 11 22:39:16 2003
---- scripts/fd.in Wed Oct 1 20:47:13 2003
-***************
-*** 139,146 ****
- return 1
- fi
- fi
-! # See if /var/lock/subsys/$1 exists
-! if [ -f /var/lock/subsys/$1 ]; then
- echo "$1 dead but subsys locked"
- return 2
- fi
---- 139,146 ----
- return 1
- fi
- fi
-! # See if @subsysdir@/$1 exists
-! if [ -f @subsysdir@/$1 ]; then
- echo "$1 dead but subsys locked"
- return 2
- fi
diff --git a/sysutils/bacula/files/patch-stored.c b/sysutils/bacula/files/patch-stored.c
new file mode 100644
index 0000000..cba5419
--- /dev/null
+++ b/sysutils/bacula/files/patch-stored.c
@@ -0,0 +1,14 @@
+--- src/stored/stored.c 23 Dec 2003 20:23:15 -0000 1.25
++++ src/stored/stored.c 2 Jan 2004 17:21:21 -0000 1.26
+@@ -185,9 +185,9 @@
+ init_stack_dump(); /* pick up new pid */
+ }
+
+- drop(uid, gid);
+-
+ create_pid_file(me->pid_directory, "bacula-sd", me->SDport);
++
++ drop(uid, gid);
+
+ /* Ensure that Volume Session Time and Id are both
+ * set and are both non-zero.
diff --git a/sysutils/bacula/pkg-install b/sysutils/bacula/pkg-install
new file mode 100644
index 0000000..5dccbf6c
--- /dev/null
+++ b/sysutils/bacula/pkg-install
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+PATH=/bin:/usr/sbin
+if [ -z "${BACULA_DIR}" ]; then
+ BACULA_DIR=/var/db/bacula
+fi
+
+case $2 in
+PRE-INSTALL)
+ USER=bacula
+ GROUP=${USER}
+ UID=910
+ GID=${UID}
+
+ if pw group show "${GROUP}" 2>/dev/null; then
+ echo "You already have a group \"${GROUP}\", so I will use it."
+ else
+ if pw groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+ fi
+
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ if pw usermod ${USER} -d ${BACULA_DIR} -G operator
+ then
+ echo "Changed home directory of \"${USER}\" to \"${BACULA_DIR}\""
+ else
+ echo "Changing home directory of \"${USER}\" to \"${BACULA_DIR}\" failed..."
+ exit 1
+ fi
+ else
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -G operator -h - \
+ -d ${BACULA_DIR} -s /sbin/nologin -c "Bacula Daemon"
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+
+ chown -R ${USER}:${GROUP} ${BACULA_DIR}
+ ;;
+esac
OpenPOWER on IntegriCloud