From 2d6c138d343f20a6314798723e58ec6595dd668d Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Tue, 10 Sep 2024 03:38:14 -0300 Subject: [PATCH] Sync with sourcezap --- libexec/portzap/commands/portzap-checkout | 4 ++-- libexec/portzap/commands/portzap-clone | 4 ++-- libexec/portzap/commands/portzap-install | 12 ++++++------ libexec/portzap/commands/portzap-pull | 4 ++-- libexec/portzap/commands/portzap-sh | 2 +- .../get-umask => scripts/get-default-umask} | 0 libexec/portzap/{utils/git/run => scripts/git} | 4 ++-- .../git-get-changed-files} | 4 ++-- .../git-get-removed-files} | 4 ++-- .../{utils/install/run => scripts/install} | 4 ++-- .../is-portzap-member} | 0 libexec/portzap/{setup => scripts}/setup-doas | 4 +++- libexec/portzap/{setup => scripts}/setup-user | 0 .../install => scripts}/update-changed-files | 8 ++++---- .../install => scripts}/update-deleted-files | 4 ++-- share/portzap/CHANGELOG | 16 ++++++++++++++++ 16 files changed, 46 insertions(+), 28 deletions(-) rename libexec/portzap/{utils/get-umask => scripts/get-default-umask} (100%) rename libexec/portzap/{utils/git/run => scripts/git} (61%) rename libexec/portzap/{utils/git/get-changed-files => scripts/git-get-changed-files} (72%) rename libexec/portzap/{utils/git/get-removed-files => scripts/git-get-removed-files} (65%) rename libexec/portzap/{utils/install/run => scripts/install} (61%) rename libexec/portzap/{utils/isportzap-member => scripts/is-portzap-member} (100%) rename libexec/portzap/{setup => scripts}/setup-doas (87%) rename libexec/portzap/{setup => scripts}/setup-user (100%) rename libexec/portzap/{utils/install => scripts}/update-changed-files (62%) rename libexec/portzap/{utils/install => scripts}/update-deleted-files (70%) diff --git a/libexec/portzap/commands/portzap-checkout b/libexec/portzap/commands/portzap-checkout index 34c3bcb..4929282 100755 --- a/libexec/portzap/commands/portzap-checkout +++ b/libexec/portzap/commands/portzap-checkout @@ -5,7 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap -git="${libexec}"/utils/git/run +git="${libexec}"/scripts/git repodir=$1 branch=$2 @@ -21,7 +21,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/utils/isportzap-member; then +if ! "${libexec}"/scripts/is-portzap-member; then printerr "$(id -un) is not a member of _portzap" exit 1 fi diff --git a/libexec/portzap/commands/portzap-clone b/libexec/portzap/commands/portzap-clone index ec7d224..232e9b0 100755 --- a/libexec/portzap/commands/portzap-clone +++ b/libexec/portzap/commands/portzap-clone @@ -5,7 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap -git="${libexec}"/utils/git/run +git="${libexec}"/scripts/git repourl=$1 repodir=$2 branch=$3 @@ -22,7 +22,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/utils/isportzap-member; then +if ! "${libexec}"/scripts/is-portzap-member; then printerr "$(id -un) is not a member of _portzap" exit 1 fi diff --git a/libexec/portzap/commands/portzap-install b/libexec/portzap/commands/portzap-install index a6a0aa1..0e7ebbe 100755 --- a/libexec/portzap/commands/portzap-install +++ b/libexec/portzap/commands/portzap-install @@ -5,8 +5,8 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap -git="${libexec}"/utils/git/run -mask=$("${libexec}"/utils/get-umask) +git="${libexec}"/scripts/git +mask=$("${libexec}"/scripts/get-default-umask) repodir=$1 installdir=$2 commitfile=$3 @@ -28,14 +28,14 @@ if [ -e "${commitfile}" ]; then ## # install update commit=$(cat "${commitfile}") - "${libexec}"/utils/install/run -d "${installdir}" - "${libexec}"/utils/install/update-deleted-files "${repodir}" "${installdir}" "${commit}" - "${libexec}"/utils/install/update-changed-files "${repodir}" "${installdir}" "${commit}" + "${libexec}"/scripts/install -d "${installdir}" + "${libexec}"/scripts/install/update-deleted-files "${repodir}" "${installdir}" "${commit}" + "${libexec}"/scripts/install/update-changed-files "${repodir}" "${installdir}" "${commit}" else ## # install from scratch umask "${mask}" - "${libexec}"/utils/install/run -d "${installdir}" + "${libexec}"/scripts/install -d "${installdir}" find -s . \ -maxdepth 1 \ ! -name "." \ diff --git a/libexec/portzap/commands/portzap-pull b/libexec/portzap/commands/portzap-pull index 7711e0b..d4a1671 100755 --- a/libexec/portzap/commands/portzap-pull +++ b/libexec/portzap/commands/portzap-pull @@ -5,7 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap -git="${libexec}"/utils/git/run +git="${libexec}"/scripts/git repodir=$1 ## @@ -20,7 +20,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/utils/isportzap-member; then +if ! "${libexec}"/scripts/is-portzap-member; then printerr "$(id -un) is not a member of _portzap" exit 1 fi diff --git a/libexec/portzap/commands/portzap-sh b/libexec/portzap/commands/portzap-sh index 7baa87f..ce91cda 100755 --- a/libexec/portzap/commands/portzap-sh +++ b/libexec/portzap/commands/portzap-sh @@ -20,7 +20,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/utils/isportzap-member; then +if ! "${libexec}"/scripts/is-portzap-member; then printerr "$(id -un) is not a member of _portzap" exit 1 fi diff --git a/libexec/portzap/utils/get-umask b/libexec/portzap/scripts/get-default-umask similarity index 100% rename from libexec/portzap/utils/get-umask rename to libexec/portzap/scripts/get-default-umask diff --git a/libexec/portzap/utils/git/run b/libexec/portzap/scripts/git similarity index 61% rename from libexec/portzap/utils/git/run rename to libexec/portzap/scripts/git index ed23c4c..9c3013e 100755 --- a/libexec/portzap/utils/git/run +++ b/libexec/portzap/scripts/git @@ -3,10 +3,10 @@ set -e ## # variables -localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap git=$(which git) -mask=$("${libexec}"/utils/get-umask) +mask=$("${libexec}"/scripts/get-default-umask) ## # main diff --git a/libexec/portzap/utils/git/get-changed-files b/libexec/portzap/scripts/git-get-changed-files similarity index 72% rename from libexec/portzap/utils/git/get-changed-files rename to libexec/portzap/scripts/git-get-changed-files index d890d81..56d0442 100755 --- a/libexec/portzap/utils/git/get-changed-files +++ b/libexec/portzap/scripts/git-get-changed-files @@ -3,9 +3,9 @@ set -e ## # variables -localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap -git="${libexec}"/utils/git/run +git="${libexec}"/scripts/git repodir=$1 commit=$2 diff --git a/libexec/portzap/utils/git/get-removed-files b/libexec/portzap/scripts/git-get-removed-files similarity index 65% rename from libexec/portzap/utils/git/get-removed-files rename to libexec/portzap/scripts/git-get-removed-files index 3142f21..76c26ac 100755 --- a/libexec/portzap/utils/git/get-removed-files +++ b/libexec/portzap/scripts/git-get-removed-files @@ -3,9 +3,9 @@ set -e ## # variables -localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap -git="${libexec}"/utils/git/run +git="${libexec}"/scripts/git repodir=$1 commit=$2 diff --git a/libexec/portzap/utils/install/run b/libexec/portzap/scripts/install similarity index 61% rename from libexec/portzap/utils/install/run rename to libexec/portzap/scripts/install index 5ca1c65..4257e93 100755 --- a/libexec/portzap/utils/install/run +++ b/libexec/portzap/scripts/install @@ -3,9 +3,9 @@ set -e ## # variables -localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap -mask=$("${libexec}"/utils/get-umask) +mask=$("${libexec}"/scripts/get-default-umask) ## # main diff --git a/libexec/portzap/utils/isportzap-member b/libexec/portzap/scripts/is-portzap-member similarity index 100% rename from libexec/portzap/utils/isportzap-member rename to libexec/portzap/scripts/is-portzap-member diff --git a/libexec/portzap/setup/setup-doas b/libexec/portzap/scripts/setup-doas similarity index 87% rename from libexec/portzap/setup/setup-doas rename to libexec/portzap/scripts/setup-doas index 78d8f00..6ea0457 100755 --- a/libexec/portzap/setup/setup-doas +++ b/libexec/portzap/scripts/setup-doas @@ -16,7 +16,9 @@ sharedir="${localbase}"/share/portzap # main src="${sharedir}"/doas.conf dest="${localbase}"/etc/doas.conf -while read -r line < "${src}"; do +# shellcheck disable=SC2002 +cat "${src}" | +while read -r line; do if grep -q "${line}" "${dest}"; then continue fi diff --git a/libexec/portzap/setup/setup-user b/libexec/portzap/scripts/setup-user similarity index 100% rename from libexec/portzap/setup/setup-user rename to libexec/portzap/scripts/setup-user diff --git a/libexec/portzap/utils/install/update-changed-files b/libexec/portzap/scripts/update-changed-files similarity index 62% rename from libexec/portzap/utils/install/update-changed-files rename to libexec/portzap/scripts/update-changed-files index af8554b..ba39dfe 100755 --- a/libexec/portzap/utils/install/update-changed-files +++ b/libexec/portzap/scripts/update-changed-files @@ -3,7 +3,7 @@ set -e ## # variables -localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap repodir=$1 installdir=$2 @@ -12,7 +12,7 @@ commit=$3 ## # main cd "${repodir}" -files=$("${libexec}"/utils/git/get-changed-files "${repodir}" "${commit}") +files=$("${libexec}"/scripts/git-get-changed-files "${repodir}" "${commit}") for file in ${files}; do target="${installdir}/${file}" parent=$(dirname "${target}") @@ -22,7 +22,7 @@ for file in ${files}; do parent=$(dirname "${parent}") done for dir in ${parents}; do - "${libexec}"/utils/install/run -d "${dir}" + "${libexec}"/scripts/install -d "${dir}" done - "${libexec}"/utils/install/run "${file}" "${target}" + "${libexec}"/scripts/install "${file}" "${target}" done diff --git a/libexec/portzap/utils/install/update-deleted-files b/libexec/portzap/scripts/update-deleted-files similarity index 70% rename from libexec/portzap/utils/install/update-deleted-files rename to libexec/portzap/scripts/update-deleted-files index 2afecef..0a4cbd7 100755 --- a/libexec/portzap/utils/install/update-deleted-files +++ b/libexec/portzap/scripts/update-deleted-files @@ -3,7 +3,7 @@ set -e ## # variables -localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap repodir=$1 installdir=$2 @@ -12,7 +12,7 @@ commit=$3 ## # main cd "${repodir}" -files=$("${libexec}"/utils/git/get-removed-files "${repodir}" "${commit}") +files=$("${libexec}"/scripts/git-get-removed-files "${repodir}" "${commit}") for file in ${files}; do target="${installdir}"/"${file}" parent=$(dirname "${target}") diff --git a/share/portzap/CHANGELOG b/share/portzap/CHANGELOG index e9c9c79..07a7583 100644 --- a/share/portzap/CHANGELOG +++ b/share/portzap/CHANGELOG @@ -1,5 +1,21 @@ # -*- mode: org -*- +* vNEXT + +**** Address ~libexec/portzap/scripts/setup-doas~ bug +This change addresses a bug in ~setup-doas~ that could hang +the ~portzap setup~ command + +**** Collapse ~libexec/portzap/scripts~ +This change does not try to organize script directories that +go beyond ~libexec/portzap/scripts~ + +**** Add ~libexec/portzap/scripts/setup~ +This new directory replaces what was formerly known as ~libexec/portzap/setup~ + +**** Add ~libexec/portzap/scripts~ +This new directory replaces what was formerly known as ~libexec/portzap/utils~ + * v1.1.0 **** Add ~libexec/portzap/utils/get-umask~