From 3e76bda8bdd5339744faf61312f4fa101bb95166 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sun, 21 Jul 2024 21:59:36 -0300 Subject: [PATCH] Update setup scripts --- bin/setup-portzap | 31 +++++++++++++------------------ libexec/portzap/setup/setup-doas | 4 ++-- 2 files changed, 15 insertions(+), 20 deletions(-) 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 }