Add libexec/portzap/{commands,utils}/

This commit is contained in:
0x1eef 2024-05-22 23:52:41 -03:00
parent 2b9707e89f
commit 4d791170a1
13 changed files with 30 additions and 30 deletions

View file

@ -24,7 +24,7 @@ require_dependency() {
}
printerr() {
"${libexec}"/printerr "$1"
"${libexec}"/utils/printerr "$1"
}
##
@ -44,22 +44,22 @@ done
case $1 in
"clone")
require_dependency "git doas"
"${libexec}"/portzap-clone "${giturl}" "${gitdir}" "${defaultbranch}"
"${libexec}"/commands/portzap-clone "${giturl}" "${gitdir}" "${defaultbranch}"
;;
"pull")
require_dependency "git doas"
"${libexec}"/portzap-pull "${gitdir}"
"${libexec}"/commands/portzap-pull "${gitdir}"
;;
"checkout")
require_dependency "git doas"
"${libexec}"/portzap-checkout "${gitdir}" "${2}"
"${libexec}"/commands/portzap-checkout "${gitdir}" "${2}"
;;
"rm")
"${libexec}"/portzap-rm "${gitdir}" "${installdir}"
"${libexec}"/commands/portzap-rm "${gitdir}" "${installdir}"
;;
"install")
require_dependency "git doas"
"${libexec}"/portzap-install "${gitdir}" "${installdir}" "${revision}"
"${libexec}"/commands/portzap-install "${gitdir}" "${installdir}" "${revision}"
;;
*)
printf "Usage: portzap COMMAND [OPTIONS]\n"

View file

@ -11,11 +11,11 @@ doas="${localbase}"/etc/doas.conf
##
# functions
printok() {
"${libexec}"/printok "$1"
"${libexec}"/utils/printok "$1"
}
printerr() {
"${libexec}"/printerr "$1"
"${libexec}"/utils/printerr "$1"
}
##

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap
git=$(which git)
mode=u=rwX,g=rX,o=
@ -19,7 +19,7 @@ gitexec()
}
printerr() {
"${libexec}"/printerr "$1"
"${libexec}"/utils/printerr "$1"
}
##
@ -29,7 +29,7 @@ if [ "$(id -u)" = "0" ]; then
exit 1
fi
if ! "${libexec}"/isportzap-member > /dev/null 2>&1; then
if ! "${libexec}"/utils/isportzap-member > /dev/null 2>&1; then
printerr "$(id -un) is not a member of _portzap"
exit 1
fi

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap
git=$(which git)
mode=u=rwX,g=rX,o=
@ -20,11 +20,11 @@ gitexec()
}
printok() {
"${libexec}"/printok "$1"
"${libexec}"/utils/printok "$1"
}
printerr() {
"${libexec}"/printerr "$1"
"${libexec}"/utils/printerr "$1"
}
##
@ -34,7 +34,7 @@ if [ "$(id -u)" = "0" ]; then
exit 1
fi
if ! "${libexec}"/isportzap-member > /dev/null 2>&1; then
if ! "${libexec}"/utils/isportzap-member > /dev/null 2>&1; then
printerr "$(id -un) is not a member of _portzap"
exit 1
fi

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap
mode=u=rwX,g=rX,o=
gitdir=$1
@ -16,8 +16,8 @@ revfile=$3
perform_update()
{
rev=$(cat "${revfile}")
add=$("${libexec}"/git-changed-files "${gitdir}" "${rev}")
del=$("${libexec}"/git-removed-files "${gitdir}" "${rev}")
add=$("${libexec}"/utils/git-changed-files "${gitdir}" "${rev}")
del=$("${libexec}"/utils/git-removed-files "${gitdir}" "${rev}")
for file in ${del}; do
target="${installdir}/${file}"
parent=$(dirname "${target}")
@ -60,11 +60,11 @@ run_install()
}
printok() {
"${libexec}"/printok "$1"
"${libexec}"/utils/printok "$1"
}
printerr() {
"${libexec}"/printerr "$1"
"${libexec}"/utils/printerr "$1"
}
##
@ -85,5 +85,5 @@ if [ -e "${revfile}" ]; then
else
perform_install
fi
"${libexec}"/git-rev "${gitdir}" > "${revfile}"
"${libexec}"/utils/git-rev "${gitdir}" > "${revfile}"
printok "install complete"

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap
git=$(which git)
mode=u=rwX,g=rX,o=
@ -18,11 +18,11 @@ gitexec()
}
printok() {
"${libexec}"/printok "$1"
"${libexec}"/utils/printok "$1"
}
printerr() {
"${libexec}"/printerr "$1"
"${libexec}"/utils/printerr "$1"
}
##
@ -32,7 +32,7 @@ if [ "$(id -u)" = "0" ]; then
exit 1
fi
if ! "${libexec}"/isportzap-member > /dev/null 2>&1; then
if ! "${libexec}"/utils/isportzap-member > /dev/null 2>&1; then
printerr "$(id -un) is not a member of _portzap"
exit 1
fi

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap
gitdir=$1
installdir=$2
@ -25,7 +25,7 @@ erase()
}
printerr() {
"${libexec}"/printerr "$1"
"${libexec}"/utils/printerr "$1"
}
##

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
git=$(which git)
mode=u=rwX,g=rX,o=
gitdir=$1

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
git=$(which git)
mode=u=rwX,g=rX,o=
gitdir=$1

View file

@ -3,7 +3,7 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../..)}
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
git=$(which git)
mode=u=rwX,g=rX,o=
gitdir=$1