Compare commits

..

No commits in common. "98b91c4d5e103eeace449f400f9b3501d3909d51" and "364d40c71fba3e3fe8ce6bf560d37e072b9c4222" have entirely different histories.

8 changed files with 14 additions and 78 deletions

View file

@ -8,19 +8,15 @@ can be installed into `/usr/ports/` by root.
## CLI
### CLI: setup
### CLI: setup-portzap
`portzap setup` should be run after installing portzap for
the first time. <br> There is no harm in running `portzap setup`
`setup-portzap` should be run after installing portzap for
the first time. <br> There is no harm in running `setup-portzap`
multiple times:
# Add the '_portzap' user, group and home directory
# This command requires root privileges
root@localhost# portzap setup
# Reverse the changes made by 'portzap setup'
# This command requires root privileges
root@localhost# portzap teardown
root@localhost# setup-portzap
### CLI: group
@ -76,7 +72,7 @@ recent version of portzap can be installed via git:
# Install
root@localhost# make install
root@localhost# portzap setup
root@localhost# setup-portzap
# Add user to '_portzap' group
root@localhost# pw groupmod -n _portzap -m <user>

View file

@ -42,12 +42,6 @@ while [ "${i}" -le "$#" ]; do
done
case $1 in
"setup")
"${libexec}"/commands/portzap-setup
;;
"teardown")
"${libexec}"/commands/portzap-teardown
;;
"clone")
require_dependency "git doas"
"${libexec}"/commands/portzap-clone "${giturl}" "${gitdir}" "${defaultbranch}"
@ -74,11 +68,7 @@ case $1 in
*)
printf "Usage: portzap COMMAND [OPTIONS]\n"
printf "\n"
printf "Setup\n"
printf " setup Setup portzap for the first time\n"
printf " teardown Reverse the changes made by 'portzap setup'\n"
printf "\n"
printf "General\n"
printf "Commands:\n"
printf " clone Clone the hardenedbsd ports tree\n"
printf " pull Pull updates from the hardenedbsd ports tree\n"
printf " checkout Checkout a branch other than the default\n"

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/..)}
libexec="${localbase}"/libexec/portzap
##

View file

@ -1,25 +0,0 @@
#!/bin/sh
set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap
user=_portzap
##
# functions
# shellcheck source=/dev/null
. "${libexec}"/functions/print.sh
##
# main
if [ "$(id -u)" = "0" ]; then
pw userdel -n "${user}" || true
pw groupdel -n "${user}" || true
rm -rf /home/"${user:?}"/ || true
printok "done"
else
printerr "you must be root"
exit 1
fi

View file

@ -16,11 +16,9 @@ sharedir="${localbase}"/share/portzap
# main
src="${sharedir}"/doas.conf
dest="${localbase}"/etc/doas.conf
while read -r line < "${src}"; do
if grep -q "${line}" "${dest}"; then
continue
fi
if grep -Fq "$(cat "${src}")" "${dest}"; then
printok "doas.conf is up to date"
else
cat "${src}" >> "${dest}"
printok "modified ${dest}"
break
done
printok "${dest} updated"
fi

View file

@ -5,5 +5,5 @@ set -e
# main
group="_portzap"
mygroups=$(id -Gn | tr ' ' '\n')
echo "${mygroups}" | grep -qe "^${group}$"
echo "${mygroups}" | grep -e "^${group}$" > /dev/null 2>&1
exit "${?}"

View file

@ -5,8 +5,6 @@
.Nm portzap
.Nd manages a copy of the HardenedBSD ports tree
.Sh SYNOPSIS
.Nm portzap setup
.Nm portzap teardown
.Nm portzap clone
.Nm portzap pull
.Nm portzap checkout
@ -18,22 +16,7 @@ manages a copy of the HardenedBSD ports tree.
The copy of the ports tree is maintained by members of
the '_portzap' group, and the copy of the ports tree
can be installed into /usr/ports/ by root.
.Sh SETUP
.sp
.sp
.Nm portzap setup
.br
Setup portzap for the first time
.br
This command requires root privileges
.Pp
.Nm portzap teardown
.br
Reverse the changes made by 'portzap setup'
.br
This command requires root privileges
.Pp
.Sh GENERAL
.Sh EXAMPLES
.sp
.sp
.Nm portzap clone

View file

@ -1,11 +1,5 @@
* vNEXT
** Add 'setup/setup-doas' improvements
More likely to do what's expected, but blind spots still exist
** Add 'portzap setup', 'portzap teardown'
Replaces and enhances 'setup-portzap'
** Add libexec/portzap/commands/portzap-sh
Runs /bin/sh within /home/_portzap/ports as the '_portzap' user