mirror of
https://github.com/unpoller/unpoller.git
synced 2026-07-30 01:32:39 -04:00
ensure user is setup in preinstall hook
This commit is contained in:
@@ -24,21 +24,6 @@ OS="$(uname -s)"
|
||||
cleanInstall() {
|
||||
printf "\033[32m Post Install of an clean install\033[0m\n"
|
||||
# Step 3 (clean install), enable the service in the proper way for this platform
|
||||
|
||||
|
||||
if [ "${OS}" = "Linux" ]; then
|
||||
# Make a user and group for this app, but only if it does not already exist.
|
||||
id unpoller >/dev/null 2>&1 || \
|
||||
useradd --system --user-group --no-create-home --home-dir /tmp --shell /bin/false unpoller
|
||||
elif [ "${OS}" = "OpenBSD" ]; then
|
||||
id unpoller >/dev/null 2>&1 || \
|
||||
useradd -g =uid -d /tmp -s /bin/false unpoller
|
||||
elif [ "${OS}" = "FreeBSD" ]; then
|
||||
id unpoller >/dev/null 2>&1 || \
|
||||
pw useradd unpoller -d /tmp -w no -s /bin/false
|
||||
else
|
||||
echo "Unknown OS: ${OS}, please add system user unpoller manually."
|
||||
fi
|
||||
|
||||
if [ "${use_systemctl}" = "False" ]; then
|
||||
if command -V chkconfig >/dev/null 2>&1; then
|
||||
|
||||
18
scripts/pre-install.sh
Executable file
18
scripts/pre-install.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
OS="$(uname -s)"
|
||||
|
||||
if [ "${OS}" = "Linux" ]; then
|
||||
# Make a user and group for this app, but only if it does not already exist.
|
||||
id unpoller >/dev/null 2>&1 || \
|
||||
useradd --system --user-group --no-create-home --home-dir /tmp --shell /bin/false unpoller
|
||||
elif [ "${OS}" = "OpenBSD" ]; then
|
||||
id unpoller >/dev/null 2>&1 || \
|
||||
useradd -g =uid -d /tmp -s /bin/false unpoller
|
||||
elif [ "${OS}" = "FreeBSD" ]; then
|
||||
id unpoller >/dev/null 2>&1 || \
|
||||
pw useradd unpoller -d /tmp -w no -s /bin/false
|
||||
else
|
||||
echo "Unknown OS: ${OS}, please add system user unpoller manually."
|
||||
fi
|
||||
Reference in New Issue
Block a user