Update setup scripts
This commit is contained in:
parent
a0988e1463
commit
3e76bda8bd
2 changed files with 15 additions and 20 deletions
|
@ -12,24 +12,19 @@ libexec="${localbase}"/libexec/portzap
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" = "0" ]; then
|
||||||
printerr "you must be root"
|
if id -u _portzap > /dev/null 2>&1; then
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if id -u _portzap > /dev/null 2>&1; then
|
|
||||||
printok "_portzap user exists"
|
printok "_portzap user exists"
|
||||||
else
|
else
|
||||||
pw useradd -n _portzap \
|
pw useradd -n _portzap \
|
||||||
-c "portzap user" \
|
-c "portzap user" \
|
||||||
-m \
|
-m \
|
||||||
-s /sbin/nologin
|
-s /sbin/nologin
|
||||||
chmod u=rwX,g=rX,o= /home/_portzap/
|
chmod u=rwX,g=rX,o= /home/_portzap/
|
||||||
printok "_portzap user created"
|
printok "_portzap user created"
|
||||||
|
fi
|
||||||
|
"${libexec}"/setup/setup-doas
|
||||||
|
else
|
||||||
|
printerr "you must be root"
|
||||||
|
exit 1
|
||||||
fi
|
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
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ install_doasconf()
|
||||||
src="${sharedir}/doas.conf"
|
src="${sharedir}/doas.conf"
|
||||||
dest="${localbase}/etc/doas.conf"
|
dest="${localbase}/etc/doas.conf"
|
||||||
if grep -Fq "$(cat "${src}")" "${dest}"; then
|
if grep -Fq "$(cat "${src}")" "${dest}"; then
|
||||||
printok "doas.conf looks up to date"
|
printok "doas.conf is up to date"
|
||||||
else
|
else
|
||||||
cat "${src}" >> "${dest}"
|
cat "${src}" >> "${dest}"
|
||||||
printok "${dest} has been updated"
|
printok "${dest} updated"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue