s|rev|commit|g, s|revfile|commitfile|g

This commit is contained in:
0x1eef 2024-08-20 02:15:14 -03:00
parent c6266e01df
commit b470001647
4 changed files with 12 additions and 12 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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}")

View file

@ -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}")