summaryrefslogtreecommitdiff
path: root/manualPorts/bareos-filedaemon
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-04-26 15:16:32 +0200
committerErich Eckner <git@eckner.net>2020-04-26 15:16:32 +0200
commit3adbade381a5c2827c3501897ea63be923ec8dfb (patch)
treee6b6bc272fc2739105371d00baae0339e31eec8e /manualPorts/bareos-filedaemon
parentcdafcd43c2096194d3ccfa259cae212dfb7db49c (diff)
downloadcrux-ports-3adbade381a5c2827c3501897ea63be923ec8dfb.tar.xz
bareos-filedaemon: fix post-install
Diffstat (limited to 'manualPorts/bareos-filedaemon')
-rwxr-xr-xmanualPorts/bareos-filedaemon/post-install46
1 files changed, 40 insertions, 6 deletions
diff --git a/manualPorts/bareos-filedaemon/post-install b/manualPorts/bareos-filedaemon/post-install
index f46d423..8fb8ece 100755
--- a/manualPorts/bareos-filedaemon/post-install
+++ b/manualPorts/bareos-filedaemon/post-install
@@ -1,14 +1,48 @@
#!/bin/sh
-/usr/lib/bareos/scripts/bareos-config initialize_local_hostname
-/usr/lib/bareos/scripts/bareos-config initialize_passwords
+# based on tor/pre-install
-if ! getent group bareos >/dev/null; then
- groupadd -r bareos
+GROUP=bareos
+USER=bareos
+USER_COMMENT="BAREOS Daemon"
+USER_HOME=/
+USER_SHELL=/bin/false
+
+if [ ! $(id -u) = 0 ]; then
+ echo "ERROR: you need to be root to run this!"
+ exit 1
fi
-if ! getent passwd bareos >/dev/null; then
- useradd -l -r -g bareos bareos
+if [ $GROUP ]; then
+ if ! getent group $GROUP > /dev/null; then
+ /usr/sbin/groupadd $GROUP
+ if [ $? -eq 0 ]; then
+ echo "Group: $GROUP added."
+ fi
+ else
+ echo "Group: $GROUP already exists! Skipping."
+ fi
+fi
+
+if ! getent passwd $USER > /dev/null; then
+ /usr/sbin/useradd -g $GROUP -c "$USER_COMMENT" -d $USER_HOME -s $USER_SHELL -m $USER
+ if [ $? -eq 0 ]; then
+ echo "User: $USER added."
+ /usr/bin/passwd -l $USER > /dev/null
+ if [ $? -eq 0 ]; then
+ echo "Locked: $USER account."
+ fi
+ else
+ echo "ERROR: unable to lock $USER account."
+ /usr/sbin/userdel $USER
+ fi
+ else
+ echo "User: $USER already exists! Skipping."
fi
+# now the bareos-specific stuff
+
+/usr/lib/bareos/scripts/bareos-config initialize_local_hostname
+/usr/lib/bareos/scripts/bareos-config initialize_passwords
+
chown -R bareos:bareos /etc/bareos