sourcezap/bin/setup-sourcezap

31 lines
635 B
Text
Raw Normal View History

2024-05-12 01:19:45 +02:00
#!/bin/sh
set -e
##
# variables
2024-06-01 05:50:47 +02:00
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/..)}
libexec="${localbase}"/libexec/sourcezap
2024-05-12 01:19:45 +02:00
2024-06-01 05:50:47 +02:00
##
# functions
2024-07-19 22:25:50 +02:00
. "${libexec}"/functions/print.sh
2024-06-01 05:50:47 +02:00
2024-05-12 01:19:45 +02:00
##
# main
2024-07-25 12:22:04 +02:00
if [ "$(id -u)" = "0" ]; then
if id -u _sourcezap > /dev/null 2>&1; then
printok "_sourcezap user exists"
else
pw useradd -n _sourcezap \
-c "sourcezap user" \
-m \
-s /sbin/nologin
chmod u=rwX,g=rX,o= /home/_sourcezap/
printok "_sourcezap user created"
fi
"${libexec}"/setup/setup-doas
else
2024-06-01 05:50:47 +02:00
printerr "you must be root"
2024-05-12 01:19:45 +02:00
exit 1
fi