]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Cleaner shell code in install-key-manager.sh.in
authorCarsten Leonhardt <leo@debian.org>
Thu, 22 Feb 2024 21:43:36 +0000 (22:43 +0100)
committerEric Bollengier <eric@baculasystems.com>
Fri, 15 Mar 2024 07:24:24 +0000 (08:24 +0100)
Change deprecated . to : in chown

Change bashism "$UID" to POSIX compatible "$(id -u)",
c.f. https://www.shellcheck.net/wiki/SC3028

Change "-o" in test to "||",
c.f. https://www.shellcheck.net/wiki/SC2166

bacula/scripts/install-key-manager.sh.in

index b35c165945ff9dc88aace92987b6b60ca6704231..bf4d31bc8dc924e0d594d4ab7dfd3dec7e4e048e 100644 (file)
@@ -136,9 +136,9 @@ uid=bacula@localhost
 passphrase=$PASSPHRASE
 stealth=off
 EOF
-   if [ "$USER" = root -o "$UID" = 0  ]; then
+   if [ "$USER" = root ] || [ "$(id -u)" = 0  ]; then
       echo change ownership to user bacula
-      chown -R bacula.bacula $KEYMAN_CONF $GNUPGHOME
+      chown -R bacula:bacula $KEYMAN_CONF $GNUPGHOME
    fi
    echo "public and private keys have been created in $GNUPGHOME"
    echo "the key-manager configuration file is in $KEYMAN_CONF"