From: Alain Spineux Date: Wed, 16 Dec 2020 15:17:16 +0000 (+0100) Subject: Fix #7141 rpm install try a "useradd root" instead of "useradd bacula" X-Git-Tag: Release-11.3.2~791 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d02bc7de071e1be71a68d5e34490a6b8fdc0b9d5;p=thirdparty%2Fbacula.git Fix #7141 rpm install try a "useradd root" instead of "useradd bacula" - the {file_daemon_user} is root - add %{bacula_user}="bacula" and use it in useradd for client-only --- diff --git a/bacula/platforms/rpms/redhat/bacula.spec.in b/bacula/platforms/rpms/redhat/bacula.spec.in index e5e03f291..17fdfa586 100644 --- a/bacula/platforms/rpms/redhat/bacula.spec.in +++ b/bacula/platforms/rpms/redhat/bacula.spec.in @@ -57,6 +57,7 @@ # Daemon user:group Don't change them unless you know what you are doing %define director_daemon_user bacula %define storage_daemon_user bacula +%define bacula_user bacula %define file_daemon_user root %define daemon_group bacula # group that has write access to tape devices, usually disk on Linux @@ -1044,6 +1045,7 @@ if [ -z "$HAVE_BACULA" ]; then echo "The user %{director_daemon_user} has been added to %{user_file}." echo "See the manual chapter \"Running Bacula\" for details." fi +# usefull only if %{file_daemon_user} is not "root" HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null` if [ -z "$HAVE_BACULA" ]; then %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1 @@ -1292,6 +1294,17 @@ if [ -z "$HAVE_BACULA" ]; then fi # we do not use the -g option allowing the primary group to be set to system default # this will be a unique group on redhat type systems or the group users on some systems + +# create the bacula user +HAVE_BACULA=`grep %{bacula_user} %{user_file} 2>/dev/null` +if [ -z "$HAVE_BACULA" ]; then + %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{bacula_user} > /dev/null 2>&1 + %{usermod} -G %{daemon_group} %{bacula_user} + echo "The user %{bacula_user} has been added to %{user_file}." + echo "See the manual chapter \"Running Bacula\" for details." +fi + +# and if %{file_daemon_user} is not root, create the dedicated file daemon user HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null` if [ -z "$HAVE_BACULA" ]; then %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1