diff --git a/bin/setup-portzap b/bin/setup-portzap index 64c5eb3..d8450bf 100755 --- a/bin/setup-portzap +++ b/bin/setup-portzap @@ -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 diff --git a/libexec/portzap/setup/setup-doas b/libexec/portzap/setup/setup-doas index d33c6f1..c8db1a4 100644 --- a/libexec/portzap/setup/setup-doas +++ b/libexec/portzap/setup/setup-doas @@ -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 }