38 lines
889 B
Bash
Executable File
38 lines
889 B
Bash
Executable File
#!/bin/sh
|
|
|
|
GETENT_USER=$(getent passwd zealot)
|
|
GETENT_GROUP=$(getent group zealot)
|
|
|
|
# Create the zealot user if it doesn't already exist
|
|
if [ "$GETENT_USER" = "" ]; then
|
|
echo "Creating the 'zealot' user."
|
|
useradd -r zealot
|
|
else
|
|
echo "The 'zealot' user already exists, skipping creation."
|
|
fi
|
|
|
|
# Create the zealot group if it doesn't already exist
|
|
if [ "$GETENT_GROUP" = "" ]; then
|
|
echo "Creating the 'zealot' group."
|
|
groupadd zealot
|
|
usermod -aG zealot zealot
|
|
else
|
|
echo "The 'zealot' group already exists, skipping creation."
|
|
fi
|
|
|
|
# Change the directory ownership of /etc
|
|
chown -R zealot:zealot /etc/zealot
|
|
|
|
# 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
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|