From b47000164796f1998d080d8bb8623cacbf11c35b Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Tue, 20 Aug 2024 02:15:14 -0300 Subject: [PATCH] s|rev|commit|g, s|revfile|commitfile|g --- bin/sourcezap | 4 ++-- libexec/sourcezap/commands/sourcezap-install | 12 ++++++------ libexec/sourcezap/utils/install/update-changed-files | 4 ++-- libexec/sourcezap/utils/install/update-deleted-files | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/sourcezap b/bin/sourcezap index 592fc79..f084b44 100755 --- a/bin/sourcezap +++ b/bin/sourcezap @@ -9,7 +9,7 @@ repodir="/home/_sourcezap/src" repourl="${SOURCEZAP_CLONEURL:-https://git.hardenedbsd.org/hardenedbsd/hardenedbsd.git}" installdir="${SOURCEZAP_INSTALLDIR:-/usr/src}" defaultbranch="hardenedbsd/main" -revfile="${installdir}"/.sourcezap +commitfile="${installdir}"/.sourcezap ## # functions @@ -71,7 +71,7 @@ case $1 in ;; "install") require_dependency git doas - "${libexec}"/commands/sourcezap-install "${repodir}" "${installdir}" "${revfile}" + "${libexec}"/commands/sourcezap-install "${repodir}" "${installdir}" "${commitfile}" ;; *) printf "Usage: sourcezap COMMAND [OPTIONS]\n" diff --git a/libexec/sourcezap/commands/sourcezap-install b/libexec/sourcezap/commands/sourcezap-install index d002b9b..ef42861 100755 --- a/libexec/sourcezap/commands/sourcezap-install +++ b/libexec/sourcezap/commands/sourcezap-install @@ -9,7 +9,7 @@ git="${libexec}"/utils/git/run mask=$("${libexec}"/utils/get-umask) repodir=$1 installdir=$2 -revfile=$3 +commitfile=$3 ## # functions @@ -24,13 +24,13 @@ if [ "$(id -u)" != "0" ]; then fi cd "${repodir}" -if [ -e "${revfile}" ]; then +if [ -e "${commitfile}" ]; then ## # install update - rev=$(cat "${revfile}") + commit=$(cat "${commitfile}") "${libexec}"/utils/install/run -d "${installdir}" - "${libexec}"/utils/install/update-deleted-files "${repodir}" "${installdir}" "${rev}" - "${libexec}"/utils/install/update-changed-files "${repodir}" "${installdir}" "${rev}" + "${libexec}"/utils/install/update-deleted-files "${repodir}" "${installdir}" "${commit}" + "${libexec}"/utils/install/update-changed-files "${repodir}" "${installdir}" "${commit}" else ## # install from scratch @@ -52,5 +52,5 @@ else -exec cp -Rpv {} "${installdir}" \; chown -Rv root "${installdir}" fi -"${git}" rev-parse HEAD > "${revfile}" +"${git}" rev-parse HEAD > "${commitfile}" printok "install complete" diff --git a/libexec/sourcezap/utils/install/update-changed-files b/libexec/sourcezap/utils/install/update-changed-files index 577cb1a..7049b60 100755 --- a/libexec/sourcezap/utils/install/update-changed-files +++ b/libexec/sourcezap/utils/install/update-changed-files @@ -7,12 +7,12 @@ localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} libexec="${localbase}"/libexec/sourcezap repodir=$1 installdir=$2 -rev=$3 +commit=$3 ## # main cd "${repodir}" -files=$("${libexec}"/utils/git/get-changed-files "${repodir}" "${rev}") +files=$("${libexec}"/utils/git/get-changed-files "${repodir}" "${commit}") for file in ${files}; do target="${installdir}/${file}" parent=$(dirname "${target}") diff --git a/libexec/sourcezap/utils/install/update-deleted-files b/libexec/sourcezap/utils/install/update-deleted-files index fdcd104..808b0c7 100755 --- a/libexec/sourcezap/utils/install/update-deleted-files +++ b/libexec/sourcezap/utils/install/update-deleted-files @@ -7,12 +7,12 @@ localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} libexec="${localbase}"/libexec/sourcezap repodir=$1 installdir=$2 -rev=$3 +commit=$3 ## # main cd "${repodir}" -files=$("${libexec}"/utils/git/get-removed-files "${repodir}" "${rev}") +files=$("${libexec}"/utils/git/get-removed-files "${repodir}" "${commit}") for file in ${files}; do target="${installdir}/${file}" parent=$(dirname "${target}")