2022-09-01 13:33:41 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-09-02 02:04:07 -04:00
|
|
|
GETENT_USER=$(getent passwd zealot)
|
|
|
|
GETENT_GROUP=$(getent group zealot)
|
2022-09-01 13:33:41 -04:00
|
|
|
|
2022-09-02 02:04:07 -04:00
|
|
|
# Create the zealot user if it doesn't already exist
|
2022-09-01 13:33:41 -04:00
|
|
|
if [ "$GETENT_USER" = "" ]; then
|
2022-10-26 09:58:46 -04:00
|
|
|
echo "Creating the 'zealot' user."
|
2022-09-02 02:04:07 -04:00
|
|
|
useradd -r zealot
|
2022-09-01 13:33:41 -04:00
|
|
|
else
|
2022-09-02 02:04:07 -04:00
|
|
|
echo "The 'zealot' user already exists, skipping creation."
|
2022-09-01 13:33:41 -04:00
|
|
|
fi
|
|
|
|
|
2022-09-02 02:04:07 -04:00
|
|
|
# Create the zealot group if it doesn't already exist
|
2022-09-01 13:33:41 -04:00
|
|
|
if [ "$GETENT_GROUP" = "" ]; then
|
2022-10-26 09:58:46 -04:00
|
|
|
echo "Creating the 'zealot' group."
|
2022-09-02 02:04:07 -04:00
|
|
|
groupadd zealot
|
|
|
|
usermod -aG zealot zealot
|
2022-09-01 13:33:41 -04:00
|
|
|
else
|
2022-09-02 02:04:07 -04:00
|
|
|
echo "The 'zealot' group already exists, skipping creation."
|
2022-09-01 13:33:41 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Change the directory ownership of /etc
|
2022-09-02 02:04:07 -04:00
|
|
|
chown -R zealot:zealot /etc/zealot
|
2022-09-01 15:44:28 -04:00
|
|
|
|
2022-10-26 09:58:46 -04:00
|
|
|
# Create the log directory under /var/log
|
|
|
|
if [ ! -d /var/log/zealot ]; then
|
|
|
|
echo "Creating /var/log/zealot to store log files."
|
|
|
|
mkdir /var/log/zealot
|
|
|
|
chown zealot:zealot /var/log/zealot
|
|
|
|
else
|
|
|
|
echo "/var/log/zealot already exists, skipping creation."
|
|
|
|
fi
|
|
|
|
|
2022-09-01 15:52:21 -04:00
|
|
|
#DEBHELPER#
|
|
|
|
|
2022-09-01 15:44:28 -04:00
|
|
|
exit 0
|