From e51227f6cf29573d38ee03bede1d081ae3784c77 Mon Sep 17 00:00:00 2001 From: Jan Görig Date: Oct 19 2010 15:29:37 +0000 Subject: initscripts fixes (#629697) --- diff --git a/bacula-dir.init b/bacula-dir.init index ecb00a0..ca01487 100644 --- a/bacula-dir.init +++ b/bacula-dir.init @@ -25,12 +25,20 @@ prog="bacula-dir" CONFIG="/etc/bacula/bacula-dir.conf" OPTS="-c $CONFIG" +if [ "$DIR_USER" != '' ]; then + OPTS="$OPTS -u $DIR_USER" +fi + +if [ "$DIR_GROUP" != '' ]; then + OPTS="$OPTS -g $DIR_GROUP" +fi + checkconf() { # Check if we still have our @@PLACEHOLDERS@@ in the config. # If yes, refuse to start, the user has never touched the config. grep -q '^[^#].*_PASSWORD@@' $CONFIG if [ $? -eq 0 ]; then - echo -n "Error: Program has not been configured" + echo -n "Error: Default password in config" echo_failure echo exit 1 diff --git a/bacula-dir.sysconfig b/bacula-dir.sysconfig new file mode 100644 index 0000000..46d2b7c --- /dev/null +++ b/bacula-dir.sysconfig @@ -0,0 +1,5 @@ +# User and group for bacula director +# If no user is set bacula will run as root + +DIR_USER=bacula +DIR_GROUP=bacula \ No newline at end of file diff --git a/bacula-fd.init b/bacula-fd.init index ca4a80d..037e9c5 100644 --- a/bacula-fd.init +++ b/bacula-fd.init @@ -25,12 +25,20 @@ prog="bacula-fd" CONFIG="/etc/bacula/bacula-fd.conf" OPTS="-c $CONFIG" +if [ "$FD_USER" != '' ]; then + OPTS="$OPTS -u $FD_USER" +fi + +if [ "$FD_GROUP" != '' ]; then + OPTS="$OPTS -g $FD_GROUP" +fi + checkconf() { # Check if we still have our @@PLACEHOLDERS@@ in the config. # If yes, refuse to start, the user has never touched the config. grep -q '_PASSWORD@@' $CONFIG if [ $? -eq 0 ]; then - echo -n "Error: Program has not been configured" + echo -n "Error: Default password in config" echo_failure echo exit 1 diff --git a/bacula-fd.sysconfig b/bacula-fd.sysconfig new file mode 100644 index 0000000..796ad1a --- /dev/null +++ b/bacula-fd.sysconfig @@ -0,0 +1,5 @@ +# User and group for bacula client +# If no user is set bacula will run as root + +FD_USER=root +FD_GROUP=root \ No newline at end of file diff --git a/bacula-sd.init b/bacula-sd.init index 25221ad..f963022 100644 --- a/bacula-sd.init +++ b/bacula-sd.init @@ -24,12 +24,20 @@ prog="bacula-sd" CONFIG="/etc/bacula/bacula-sd.conf" OPTS="-c $CONFIG" +if [ "$SD_USER" != '' ]; then + OPTS="$OPTS -u $SD_USER" +fi + +if [ "$SD_GROUP" != '' ]; then + OPTS="$OPTS -g $SD_GROUP" +fi + checkconf() { # Check if we still have our @@PLACEHOLDERS@@ in the config. # If yes, refuse to start, the user has never touched the config. grep -q '^[^#].*_PASSWORD@@' $CONFIG if [ $? -eq 0 ]; then - echo -n "Error: Program has not been configured" + echo -n "Error: Default password in config" echo_failure echo exit 1 diff --git a/bacula-sd.sysconfig b/bacula-sd.sysconfig new file mode 100644 index 0000000..83d78fb --- /dev/null +++ b/bacula-sd.sysconfig @@ -0,0 +1,5 @@ +# Users for bacula storage +# If no user is set bacula will run as root + +SD_USER=bacula +SD_GROUP=disk diff --git a/bacula.spec b/bacula.spec index e35f8cd..f1a3c8f 100644 --- a/bacula.spec +++ b/bacula.spec @@ -8,7 +8,7 @@ Summary: Cross platform network backup for Linux, Unix, Mac and Windows Name: bacula Version: 5.0.3 -Release: 3%{?dist} +Release: 4%{?dist} # See LICENSE for details License: GPLv2 with exceptions Group: System Environment/Daemons @@ -27,6 +27,9 @@ Source9: bacula-sd.init Source12: bacula-bat.desktop Source13: bacula-traymonitor.console_apps Source14: bacula-wxconsole.console_apps +Source15: bacula-fd.sysconfig +Source16: bacula-dir.sysconfig +Source17: bacula-sd.sysconfig Patch0: bacula-director-configuration.patch Patch1: bacula-config.patch #Patch2: bacula-wxconsole.patch @@ -394,7 +397,7 @@ export QMAKE=/usr/bin/qmake-qt4 --with-dir-user=bacula \ --with-dir-group=bacula \ --with-sd-user=bacula \ - --with-sd-group=bacula \ + --with-sd-group=disk \ --with-fd-user=root \ --with-fd-group=root \ --with-dir-password=@@DIR_PASSWORD@@ \ @@ -611,6 +614,12 @@ install -m 755 -D %{SOURCE8} %{buildroot}%{_initrddir}/bacula-dir install -m 755 -D %{SOURCE9} %{buildroot}%{_initrddir}/bacula-sd +# Sysconfig +install -m 644 -D %{SOURCE15} %{buildroot}%{_sysconfdir}/sysconfig/bacula-fd +install -m 644 -D %{SOURCE16} %{buildroot}%{_sysconfdir}/sysconfig/bacula-dir +install -m 644 -D %{SOURCE17} %{buildroot}%{_sysconfdir}/sysconfig/bacula-sd + + # Wipe backup files from the multiple make install calls rm -vf %{buildroot}%{_sysconfdir}/bacula/*.{new,old} rm -vf %{buildroot}%{_libexecdir}/bacula/*.{new,old} @@ -810,6 +819,7 @@ fi %{_sbindir}/bacula-fd %{_initrddir}/bacula-fd %config(noreplace) %{_sysconfdir}/bacula/bacula-fd.conf +%config(noreplace) %{_sysconfdir}/sysconfig/bacula-fd %{_mandir}/man8/bacula-fd.8* @@ -864,6 +874,7 @@ fi %config(noreplace) %{_sysconfdir}/bacula/query.sql %config %{_sysconfdir}/logwatch/conf/logfiles/bacula.conf %config %{_sysconfdir}/logwatch/conf/services/bacula.conf +%config(noreplace) %{_sysconfdir}/sysconfig/bacula-dir %{_sysconfdir}/logwatch/scripts/services/bacula %{_sysconfdir}/logwatch/scripts/shared/applybaculadate %{_initrddir}/bacula-dir @@ -940,6 +951,7 @@ fi %{_sbindir}/bls %{_sbindir}/btape %config(noreplace) %{_sysconfdir}/bacula/bacula-sd.conf +%config(noreplace) %{_sysconfdir}/sysconfig/bacula-sd %{_initrddir}/bacula-sd %{_libexecdir}/bacula/disk-changer %{_libexecdir}/bacula/dvd-handler @@ -1006,6 +1018,10 @@ fi %changelog +* Tue Oct 19 2010 Jan Görig - 5.0.3-4 +- Fixed initscripts and changed default group of bacula-sd (#629697) +- Better warning for non-configured password (#556669) + * Wed Sep 29 2010 jkeating - 5.0.3-3 - Rebuilt for gcc bug 634757