overseer/build/scripts/postinst.sh
Gregory Ballantine 21b48b1f3c
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Added debian packaging process
2022-11-04 09:07:31 -04:00

42 lines
1.1 KiB
Bash
Executable File

#!/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
#DEBHELPER#
exit 0