2022-11-04 09:07:31 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
GETENT_USER=$(getent passwd overseer)
|
|
|
|
GETENT_GROUP=$(getent group overseer)
|
|
|
|
|
|
|
|
# Create the overseer user if it doesn't already exist
|
|
|
|
if [ "$GETENT_USER" = "" ]; then
|
|
|
|
echo "Creating the 'overseer' user."
|
|
|
|
useradd -r overseer
|
|
|
|
else
|
|
|
|
echo "The 'overseer' user already exists, skipping creation."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create the overseer group if it doesn't already exist
|
|
|
|
if [ "$GETENT_GROUP" = "" ]; then
|
|
|
|
echo "Creating the 'overseer' group."
|
|
|
|
groupadd overseer
|
|
|
|
usermod -aG overseer overseer
|
|
|
|
else
|
|
|
|
echo "The 'overseer' group already exists, skipping creation."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Change the directory ownership of /etc
|
|
|
|
chown -R overseer:overseer /etc/overseer
|
|
|
|
|
|
|
|
# Create the log directory under /var/log
|
|
|
|
if [ ! -d /var/log/overseer ]; then
|
|
|
|
echo "Creating /var/log/overseer to store log files."
|
|
|
|
mkdir /var/log/overseer
|
|
|
|
chown overseer:overseer /var/log/overseer
|
|
|
|
else
|
|
|
|
echo "/var/log/overseer already exists, skipping creation."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure the app's source and configuration files are owned the new user and group
|
|
|
|
chown -R overseer:overseer /opt/overseer
|
|
|
|
chown -R overseer:overseer /etc/overseer
|
|
|
|
|
2022-11-09 14:33:58 -05:00
|
|
|
# Reload systemd unit files
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
2022-11-04 09:07:31 -04:00
|
|
|
#DEBHELPER#
|
|
|
|
|
|
|
|
exit 0
|