Package: bacula-fd
Version: 2.4.4-1
Severity: wishlist
Tags: patch

Hi,

I'm trying to run bacula-fd with readonly permissions, but since root has 
complete
access on all files the only way to achieve this is to run it by user 'bacula' 
and
group 'bacula' and add readonly permissions to the files that are to be backed 
up.

The good news is that 'bacula-fd' already have these parameters (-u,-g). The bad
news is that the only way to make use of these is to modify the main control 
script
/etc/init.d/bacula-fd because it doesn't read the /etc/default/bacula-fd local
configuration file meant for personal customizations.

This is the patch that I'm using without any problem so far:
cobra:~# diff -pU2 /etc/init.d/bacula-fd_2.4.4-1 /etc/init.d/bacula-fd
--- /etc/init.d/bacula-fd_2.4.4-1       2009-01-09 23:10:49.000000000 +0200
+++ /etc/init.d/bacula-fd       2009-11-11 16:31:31.000000000 +0200
@@ -16,14 +16,16 @@
 #      Customized for Bacula by Jose Luis Tallon <jltal...@adv-solutions.net>
 #
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
+PATH="/sbin:/bin:/usr/sbin:/usr/bin"
+set -e
+
 DAEMON=/usr/sbin/bacula-fd
 NAME="bacula-fd"
 PORT=9102
 DESC="Bacula File daemon"
-ARGS="-c /etc/bacula/bacula-fd.conf"
 
 test -f $DAEMON || exit 0
-
-set -e
+. /etc/default/bacula-fd
+CONFIG="${CONFIG:-/etc/bacula/bacula-fd.conf}"
+PIDFILE=/var/run/bacula/$NAME.$PORT.pid
 
 if [ -n "`getent services bacula-fd`" ]; then
@@ -34,10 +36,8 @@ fi
 create_var_run_dir
 
-PIDFILE=/var/run/bacula/$NAME.$PORT.pid
-
 case "$1" in
   start)
-       if [ -f /etc/bacula/do_not_run ]; then
-               echo "Not starting $DESC: disabled via /etc/bacula/do_not_run"
+       if [ "$DISABLED" != "no" ]; then
+               echo "Not starting $DESC: disabled via /etc/default/bacula-fd"
                exit 0
        fi
@@ -45,5 +45,5 @@ case "$1" in
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
-               --exec $DAEMON -- $ARGS
+               --exec $DAEMON -- -c $CONFIG $ARGS
        echo "$NAME."
        ;;
@@ -51,5 +51,5 @@ case "$1" in
        echo -n "Stopping $DESC: "
        start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
-               --exec $DAEMON -- $ARGS
+               --exec $DAEMON -- -c $CONFIG $ARGS
        echo "$NAME."
        ;;
@@ -58,8 +58,8 @@ case "$1" in
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE  \
-               --exec $DAEMON -- $ARGS
+               --exec $DAEMON -- -c $CONFIG $ARGS
        sleep 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
-               --exec $DAEMON -- $ARGS
+               --exec $DAEMON -- -c $CONFIG $ARGS
        echo "$NAME."
        ;;
@@ -72,2 +72,4 @@ esac
 
 exit 0
+
+


This is the content of the custom file that can be used as a template:
cobra:~# cat /etc/default/bacula-fd 
## aditional parameters for 'bacula-fd'
ARGS="-u bacula -g bacula"

## here you can set a custom configuration file
CONFIG=""

## any value different than 'no' will disable the
##  the service to automatically start at boot
DISABLED="no"


This patch applies to the latest version of 'bacula-fd' too (v3.0.2-3).
I've also attached the new script if you prefer it this way.

Thanks


-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages bacula-fd depends on:
ii  bacula-common          2.4.4-1           network backup, recovery and verif
ii  libacl1                2.2.47-2          Access control list shared library
ii  libc6                  2.7-18            GNU C Library: Shared libraries
ii  libgcc1                1:4.3.2-1.1       GCC support library
ii  libstdc++6             4.3.2-1.1         The GNU Standard C++ Library v3
ii  libwrap0               7.6.q-16          Wietse Venema's TCP wrappers libra
ii  python2.5              2.5.2-15          An interactive high-level object-o
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

bacula-fd recommends no packages.

Versions of packages bacula-fd suggests:
pn  bacula-traymonitor            <none>     (no description available)

-- no debconf information


-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (990, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages bacula-fd depends on:
ii  bacula-common          2.4.4-1           network backup, recovery and verif
ii  libacl1                2.2.47-2          Access control list shared library
ii  libc6                  2.7-18            GNU C Library: Shared libraries
ii  libgcc1                1:4.3.2-1.1       GCC support library
ii  libstdc++6             4.3.2-1.1         The GNU Standard C++ Library v3
ii  libwrap0               7.6.q-16          Wietse Venema's TCP wrappers libra
ii  python2.5              2.5.2-15          An interactive high-level object-o
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

bacula-fd recommends no packages.

Versions of packages bacula-fd suggests:
pn  bacula-traymonitor            <none>     (no description available)

-- no debconf information
#!/bin/sh
### BEGIN INIT INFO
# Provides:          bacula-fd
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      bacula-sd
# Should-Stop:       bacula-sd
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO
#
# bacula-fd	SysV init script for Bacula-FD.
#
#	Written by Miquel van Smoorenburg <miqu...@cistron.nl>.
#	Modified for Debian GNU/Linux by Ian Murdock <imurd...@gnu.ai.mit.edu>.
#	Customized for Bacula by Jose Luis Tallon <jltal...@adv-solutions.net>
#
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
set -e

DAEMON=/usr/sbin/bacula-fd
NAME="bacula-fd"
PORT=9102
DESC="Bacula File daemon"

test -f $DAEMON || exit 0
. /etc/default/bacula-fd
CONFIG="${CONFIG:-/etc/bacula/bacula-fd.conf}"
PIDFILE=/var/run/bacula/$NAME.$PORT.pid

if [ -n "`getent services bacula-fd`" ]; then
	PORT=`getent services bacula-fd | awk '{ gsub("/tcp","",$2); print $2; }'`
fi

. /usr/share/bacula-common/common-functions
create_var_run_dir

case "$1" in
  start)
	if [ "$DISABLED" != "no" ]; then
		echo "Not starting $DESC: disabled via /etc/default/bacula-fd"
		exit 0
	fi

	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
		--exec $DAEMON -- -c $CONFIG $ARGS
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
		--exec $DAEMON -- -c $CONFIG $ARGS
	echo "$NAME."
	;;

  restart|force-reload)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE  \
		--exec $DAEMON -- -c $CONFIG $ARGS
	sleep 1
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
		--exec $DAEMON -- -c $CONFIG $ARGS
	echo "$NAME."
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0


Reply via email to