diff --git a/bin/portzap b/bin/portzap index 6b38656..888ed89 100755 --- a/bin/portzap +++ b/bin/portzap @@ -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" diff --git a/bin/setup-portzap b/bin/setup-portzap index b9cb2c1..f4189a8 100755 --- a/bin/setup-portzap +++ b/bin/setup-portzap @@ -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" } ## diff --git a/libexec/portzap/portzap-checkout b/libexec/portzap/commands/portzap-checkout similarity index 80% rename from libexec/portzap/portzap-checkout rename to libexec/portzap/commands/portzap-checkout index bfb481b..c2f1cca 100644 --- a/libexec/portzap/portzap-checkout +++ b/libexec/portzap/commands/portzap-checkout @@ -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 diff --git a/libexec/portzap/portzap-clone b/libexec/portzap/commands/portzap-clone similarity index 77% rename from libexec/portzap/portzap-clone rename to libexec/portzap/commands/portzap-clone index c37c942..a55661c 100755 --- a/libexec/portzap/portzap-clone +++ b/libexec/portzap/commands/portzap-clone @@ -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 diff --git a/libexec/portzap/portzap-install b/libexec/portzap/commands/portzap-install similarity index 82% rename from libexec/portzap/portzap-install rename to libexec/portzap/commands/portzap-install index 572f814..d405a55 100755 --- a/libexec/portzap/portzap-install +++ b/libexec/portzap/commands/portzap-install @@ -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" diff --git a/libexec/portzap/portzap-pull b/libexec/portzap/commands/portzap-pull similarity index 76% rename from libexec/portzap/portzap-pull rename to libexec/portzap/commands/portzap-pull index d4c4418..ca3d2be 100755 --- a/libexec/portzap/portzap-pull +++ b/libexec/portzap/commands/portzap-pull @@ -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 diff --git a/libexec/portzap/portzap-rm b/libexec/portzap/commands/portzap-rm similarity index 91% rename from libexec/portzap/portzap-rm rename to libexec/portzap/commands/portzap-rm index d6e929c..b8fc488 100644 --- a/libexec/portzap/portzap-rm +++ b/libexec/portzap/commands/portzap-rm @@ -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" } ## diff --git a/libexec/portzap/git-changed-files b/libexec/portzap/utils/git-changed-files similarity index 85% rename from libexec/portzap/git-changed-files rename to libexec/portzap/utils/git-changed-files index 7cacdce..aa708cb 100644 --- a/libexec/portzap/git-changed-files +++ b/libexec/portzap/utils/git-changed-files @@ -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 diff --git a/libexec/portzap/git-removed-files b/libexec/portzap/utils/git-removed-files similarity index 81% rename from libexec/portzap/git-removed-files rename to libexec/portzap/utils/git-removed-files index ae7a346..a3424e8 100644 --- a/libexec/portzap/git-removed-files +++ b/libexec/portzap/utils/git-removed-files @@ -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 diff --git a/libexec/portzap/git-rev b/libexec/portzap/utils/git-rev similarity index 78% rename from libexec/portzap/git-rev rename to libexec/portzap/utils/git-rev index 77e30ef..1784bc2 100644 --- a/libexec/portzap/git-rev +++ b/libexec/portzap/utils/git-rev @@ -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 diff --git a/libexec/portzap/isportzap-member b/libexec/portzap/utils/isportzap-member similarity index 100% rename from libexec/portzap/isportzap-member rename to libexec/portzap/utils/isportzap-member diff --git a/libexec/portzap/printerr b/libexec/portzap/utils/printerr similarity index 100% rename from libexec/portzap/printerr rename to libexec/portzap/utils/printerr diff --git a/libexec/portzap/printok b/libexec/portzap/utils/printok similarity index 100% rename from libexec/portzap/printok rename to libexec/portzap/utils/printok