Update setup scripts

This commit is contained in:
0x1eef 2024-07-21 21:59:36 -03:00
parent a0988e1463
commit 3e76bda8bd
2 changed files with 15 additions and 20 deletions

View file

@ -12,24 +12,19 @@ libexec="${localbase}"/libexec/portzap
##
# main
if [ "$(id -u)" != "0" ]; then
if [ "$(id -u)" = "0" ]; then
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
else
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

View file

@ -16,10 +16,10 @@ install_doasconf()
src="${sharedir}/doas.conf"
dest="${localbase}/etc/doas.conf"
if grep -Fq "$(cat "${src}")" "${dest}"; then
printok "doas.conf looks up to date"
printok "doas.conf is up to date"
else
cat "${src}" >> "${dest}"
printok "${dest} has been updated"
printok "${dest} updated"
fi
}