Skip to content

Commit

Permalink
Support BusyBox for user creation/deletion
Browse files Browse the repository at this point in the history
While (un)installing the binary release, assume BusyBox if the useradd
command isn't available.
  • Loading branch information
weiss committed Oct 1, 2023
1 parent e436e63 commit 0481cc0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tools/make-installers
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion tools/publish-release
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0481cc0

Please sign in to comment.