From a9f8daac78409a22aa8a054207d363004f270a10 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Fri, 7 Jun 2024 13:07:11 -0300 Subject: [PATCH] Update git-* utils Default to a localbase path that is relative to the current file, and call git via utils/gitexec --- libexec/sourcezap/utils/git-changed-files | 8 +++----- libexec/sourcezap/utils/git-removed-files | 8 +++----- libexec/sourcezap/utils/git-rev | 7 +++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/libexec/sourcezap/utils/git-changed-files b/libexec/sourcezap/utils/git-changed-files index 16b948c..6a84d79 100755 --- a/libexec/sourcezap/utils/git-changed-files +++ b/libexec/sourcezap/utils/git-changed-files @@ -3,18 +3,16 @@ set -e ## # variables -localbase=${LOCALBASE:-/usr/local} -git="${localbase}"/bin/git +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} +libexec="${localbase}"/libexec/sourcezap gitdir=$1 commit=$2 -mode=u=rwX,g=rX,o= ## # functions gitexec() { - doas -n -u _sourcezap \ - /bin/sh -c "umask ${mode}; ${git} ${1}" + "${libexec}"/utils/gitexec "${1}" } ## diff --git a/libexec/sourcezap/utils/git-removed-files b/libexec/sourcezap/utils/git-removed-files index 6603ff1..21ff236 100755 --- a/libexec/sourcezap/utils/git-removed-files +++ b/libexec/sourcezap/utils/git-removed-files @@ -3,18 +3,16 @@ set -e ## # variables -localbase=${LOCALBASE:-/usr/local} -git="${localbase}"/bin/git +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} +libexec="${localbase}"/libexec/sourcezap gitdir=$1 commit=$2 -mode=u=rwX,g=rX,o= ## # functions gitexec() { - doas -n -u _sourcezap \ - /bin/sh -c "umask ${mode}; ${git} ${1}" + "${libexec}"/utils/gitexec "${1}" } ## diff --git a/libexec/sourcezap/utils/git-rev b/libexec/sourcezap/utils/git-rev index 48e1cdb..d025ecf 100755 --- a/libexec/sourcezap/utils/git-rev +++ b/libexec/sourcezap/utils/git-rev @@ -3,16 +3,15 @@ set -e ## # variables -git=/usr/local/bin/git +localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} +libexec="${localbase}"/libexec/sourcezap gitdir=$1 -mode=u=rwX,g=rX,o= ## # functions gitexec() { - doas -n -u _sourcezap \ - /bin/sh -c "umask ${mode}; ${git} ${1}" + "${libexec}"/utils/gitexec "${1}" } ##