From 0481cc05cca838f4feeee53c2408193311324259 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 1 Oct 2023 20:29:47 +0200 Subject: [PATCH] Support BusyBox for user creation/deletion While (un)installing the binary release, assume BusyBox if the useradd command isn't available. --- tools/make-installers | 6 +++++- tools/publish-release | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/make-installers b/tools/make-installers index 50e526c4a..316a349a1 100755 --- a/tools/make-installers +++ b/tools/make-installers @@ -117,7 +117,11 @@ create_setup_script() fi if [ \$user_exists = false ] - then useradd -r -d '$rel_dir' '$rel_name' + then + if type 'useradd' >'/dev/null' + then useradd -r -d '$rel_dir' '$rel_name' + else adduser -S -h '$rel_dir' '$rel_name' + fi fi tar -C "\$(dirname '$rel_dir')" -xf '$tarball' diff --git a/tools/publish-release b/tools/publish-release index e996d9071..a3b9919ca 100755 --- a/tools/publish-release +++ b/tools/publish-release @@ -130,6 +130,9 @@ cat >"$web_root_dir/uninstall" <<-EOF rm -f /etc/systemd/system/\$rel_name.service fi rm -rf "/opt/\$rel_name" - userdel "\$rel_name" + if type 'userdel' >'/dev/null' + then userdel "\$rel_name" + else deluser "\$rel_name" + fi echo "\$rel_name has been uninstalled successfully." EOF