From e3d82b207dc1191180caf6fc15b565f50f5626a6 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sat, 1 Jun 2024 01:02:12 -0300 Subject: [PATCH] Adopt remaining major portzap updates --- Makefile | 10 ++++++---- libexec/sourcezap/commands/sourcezap-checkout | 2 +- libexec/sourcezap/commands/sourcezap-clone | 4 ++-- libexec/sourcezap/commands/sourcezap-install | 14 ++++++++++---- libexec/sourcezap/commands/sourcezap-pull | 2 +- libexec/sourcezap/{ => utils}/git-changed-files | 0 libexec/sourcezap/{ => utils}/git-removed-files | 0 libexec/sourcezap/{ => utils}/git-rev | 0 libexec/sourcezap/{ => utils}/issourcezap-member | 0 9 files changed, 20 insertions(+), 12 deletions(-) rename libexec/sourcezap/{ => utils}/git-changed-files (100%) rename libexec/sourcezap/{ => utils}/git-removed-files (100%) rename libexec/sourcezap/{ => utils}/git-rev (100%) rename libexec/sourcezap/{ => utils}/issourcezap-member (100%) diff --git a/Makefile b/Makefile index be92d27..75d427f 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,11 @@ LIBEXECDIR = $(PREFIX)/libexec/sourcezap SHAREDIR = $(PREFIX)/share/sourcezap install: - install -d $(BINDIR) $(LIBEXECDIR) $(SHAREDIR) $(MANDIR) + install -d $(BINDIR) $(LIBEXECDIR) $(LIBEXECDIR)/commands $(LIBEXECDIR)/utils $(SHAREDIR) $(MANDIR) install -m 0755 bin/sourcezap $(BINDIR) install -m 0755 bin/setup-sourcezap $(BINDIR) - install -m 0755 libexec/sourcezap/* $(LIBEXECDIR) + install -m 0755 libexec/sourcezap/commands/* $(LIBEXECDIR)/commands + install -m 0755 libexec/sourcezap/utils/* $(LIBEXECDIR)/utils install -m 0644 share/sourcezap/* $(SHAREDIR) install -m 0644 man/man8/sourcezap.8 $(MANDIR) @@ -20,5 +21,6 @@ deinstall: rm -rf $(SHAREDIR) shellcheck: - shellcheck bin/sourcezap - shellcheck libexec/sourcezap/* + shellcheck bin/* + shellcheck libexec/sourcezap/utils/* + shellcheck libexec/sourcezap/commands/* diff --git a/libexec/sourcezap/commands/sourcezap-checkout b/libexec/sourcezap/commands/sourcezap-checkout index 5df31d0..ab71ed6 100755 --- a/libexec/sourcezap/commands/sourcezap-checkout +++ b/libexec/sourcezap/commands/sourcezap-checkout @@ -32,7 +32,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/issourcezap-member; then +if ! "${libexec}"/utils/issourcezap-member; then printerr "$(id -un) is not a member of _sourcezap" exit 1 fi diff --git a/libexec/sourcezap/commands/sourcezap-clone b/libexec/sourcezap/commands/sourcezap-clone index 3d253bb..e7eb06a 100755 --- a/libexec/sourcezap/commands/sourcezap-clone +++ b/libexec/sourcezap/commands/sourcezap-clone @@ -18,7 +18,7 @@ gitexec() printok() { - "${libexec}"/utils/printerr "${1}" + "${libexec}"/utils/printok "${1}" } printerr() @@ -33,7 +33,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/issourcezap-member; then +if ! "${libexec}"/utils/issourcezap-member; then printerr "$(id -un) is not a member of _sourcezap" exit 1 fi diff --git a/libexec/sourcezap/commands/sourcezap-install b/libexec/sourcezap/commands/sourcezap-install index 02be93e..e03e50f 100755 --- a/libexec/sourcezap/commands/sourcezap-install +++ b/libexec/sourcezap/commands/sourcezap-install @@ -15,8 +15,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}") @@ -64,6 +64,11 @@ run_install() install -o root -g _sourcezap -m "${mode}" -v "$@" } +printok() +{ + "${libexec}"/utils/printok "${1}" +} + printerr() { "${libexec}"/utils/printerr "${1}" @@ -79,7 +84,6 @@ fi set -x umask ${mode} cd "${gitdir}" -set +x run_install "-d" "${installdir}" chmod ${mode} "${installdir}" if [ -e "${revfile}" ]; then @@ -87,4 +91,6 @@ if [ -e "${revfile}" ]; then else perform_install fi -"${libexec}"/git-rev "${gitdir}" > "${revfile}" +"${libexec}"/utils/git-rev "${gitdir}" > "${revfile}" +set +x +printok "install complete" diff --git a/libexec/sourcezap/commands/sourcezap-pull b/libexec/sourcezap/commands/sourcezap-pull index 613d415..d8717de 100755 --- a/libexec/sourcezap/commands/sourcezap-pull +++ b/libexec/sourcezap/commands/sourcezap-pull @@ -31,7 +31,7 @@ if [ "$(id -u)" = "0" ]; then exit 1 fi -if ! "${libexec}"/issourcezap-member; then +if ! "${libexec}"/utils/issourcezap-member; then printerr "$(id -un) is not a member of _sourcezap" exit 1 fi diff --git a/libexec/sourcezap/git-changed-files b/libexec/sourcezap/utils/git-changed-files similarity index 100% rename from libexec/sourcezap/git-changed-files rename to libexec/sourcezap/utils/git-changed-files diff --git a/libexec/sourcezap/git-removed-files b/libexec/sourcezap/utils/git-removed-files similarity index 100% rename from libexec/sourcezap/git-removed-files rename to libexec/sourcezap/utils/git-removed-files diff --git a/libexec/sourcezap/git-rev b/libexec/sourcezap/utils/git-rev similarity index 100% rename from libexec/sourcezap/git-rev rename to libexec/sourcezap/utils/git-rev diff --git a/libexec/sourcezap/issourcezap-member b/libexec/sourcezap/utils/issourcezap-member similarity index 100% rename from libexec/sourcezap/issourcezap-member rename to libexec/sourcezap/utils/issourcezap-member