Fix the population of doas.conf

We weren't populating doas.conf when it had vaguely similar
content already present.
This commit is contained in:
0x1eef 2024-04-17 07:10:26 -03:00
parent d868030a1c
commit d99af1d516

View file

@ -8,16 +8,24 @@ doas="${localbase}"/etc/doas.conf
## ##
# main # main
if ! id -u _portzap > /dev/null 2>&1; then if id -u _portzap > /dev/null 2>&1; then
echo "[-] The _portzap user exists"
echo "[-] Add user(s) to the _portzap group:"
echo "root# pw groupmod -n _portzap -m user1,user2"
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/
echo "[ok] add _portzap user, group and home directory" echo "[-] The _portzap user, group and home directory have been created."
echo "[-] Add user(s) to the _portzap group:"
echo "root# pw groupmod -n _portzap -m user1,user2"
fi fi
if ! grep -F "${conf}" "${doas}" > /dev/null 2>&1; then if grep -F "^${conf}$" "${doas}" > /dev/null 2>&1; then
echo "${conf}" >> "${doas}" echo "[-] No changes made to ${doas}"
echo "[ok] modify ${doas}" else
echo "$conf" >> "$doas"
echo "[-] ${doas} has been changed. Please review the changes"
fi fi