portzap/bin/setup-portzap
0x1eef a0988e1463 Remove setup-cron
I'm not sure about this feature, and since it hasn't been released
yet, I'd prefer not to include it
2024-07-21 21:52:21 -03:00

35 lines
693 B
Bash
Executable file

#!/bin/sh
set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/..)}
libexec="${localbase}"/libexec/portzap
##
# functions
. "${libexec}"/functions/print.sh
##
# main
if [ "$(id -u)" != "0" ]; then
printerr "you must be root"
exit 1
fi
if id -u _portzap > /dev/null 2>&1; then
printok "_portzap user exists"
else
pw useradd -n _portzap \
-c "portzap user" \
-m \
-s /sbin/nologin
chmod u=rwX,g=rX,o= /home/_portzap/
printok "_portzap user created"
fi
"${libexec}"/setup/setup-doas
echo
echo "If you haven't already, add users to the _portzap group: "
echo "root@$(hostname)# pw groupmod -n _portzap -m user1,user2"
echo