This commit is contained in:
parent
36cb7591ee
commit
f8bcf60ae1
4 changed files with 35 additions and 12 deletions
|
@ -10,8 +10,9 @@ can be installed into `/usr/src/` by root.
|
||||||
|
|
||||||
#### CLI: setup-sourcezap
|
#### CLI: setup-sourcezap
|
||||||
|
|
||||||
This command should be run after installing sourcezap for
|
`setup-sourcezap` should be run after installing
|
||||||
the first time:
|
sourcezap for the first time. <br> There is no harm in
|
||||||
|
running `setup-sourcezap` multiple times:
|
||||||
|
|
||||||
# Add the '_sourcezap' user, group and home directory
|
# Add the '_sourcezap' user, group and home directory
|
||||||
# This command requires root privileges
|
# This command requires root privileges
|
||||||
|
|
|
@ -13,16 +13,7 @@ libexec="${localbase}"/libexec/sourcezap
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
if [ "$(id -u)" = "0" ]; then
|
if [ "$(id -u)" = "0" ]; then
|
||||||
if id -u _sourcezap > /dev/null 2>&1; then
|
"${libexec}"/setup/setup-user
|
||||||
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
|
"${libexec}"/setup/setup-doas
|
||||||
else
|
else
|
||||||
printerr "you must be root"
|
printerr "you must be root"
|
||||||
|
|
26
libexec/sourcezap/setup/setup-user
Executable file
26
libexec/sourcezap/setup/setup-user
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
##
|
||||||
|
# variables
|
||||||
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
||||||
|
libexec="${localbase}"/libexec/sourcezap
|
||||||
|
user="_sourcezap"
|
||||||
|
|
||||||
|
##
|
||||||
|
# functions
|
||||||
|
. "${libexec}"/functions/print.sh
|
||||||
|
|
||||||
|
##
|
||||||
|
# main
|
||||||
|
if id -u "${user}" > /dev/null 2>&1; then
|
||||||
|
printok "${user} user exists"
|
||||||
|
else
|
||||||
|
pw useradd
|
||||||
|
-n "${user}" \
|
||||||
|
-c "sourcezap user" \
|
||||||
|
-m \
|
||||||
|
-s /sbin/nologin
|
||||||
|
chmod u=rwX,g=rX,o= /home/"${user}"/
|
||||||
|
printok "${user} user created"
|
||||||
|
fi
|
|
@ -1,5 +1,10 @@
|
||||||
v?.?.?
|
v?.?.?
|
||||||
|
|
||||||
|
| Add libexec/sourcezap/setup/setup-user
|
||||||
|
Move the code that handles the creation of the '_sourcezap'
|
||||||
|
user from bin/setup-sourcezap to the libexec/sourcezap/setup/
|
||||||
|
directory
|
||||||
|
|
||||||
| Recover from "git checkout" failure
|
| Recover from "git checkout" failure
|
||||||
After this change, "git checkout" exiting unsuccessfully
|
After this change, "git checkout" exiting unsuccessfully
|
||||||
towards the end of "sourcezap clone" no longer causes
|
towards the end of "sourcezap clone" no longer causes
|
||||||
|
|
Loading…
Reference in a new issue