s|rev|commit|g, s|revfile|commitfile|g
Some checks failed
portzap / shellcheck (push) Has been cancelled

This commit is contained in:
0x1eef 2024-08-20 02:17:05 -03:00
parent 218dbcad15
commit 2039076720
4 changed files with 12 additions and 12 deletions

View file

@ -9,7 +9,7 @@ gitdir="/home/_portzap/ports"
giturl="${PORTZAP_CLONEURL:-https://git.hardenedbsd.org/hardenedbsd/ports.git}"
installdir="${PORTZAP_INSTALLDIR:-/usr/ports}"
defaultbranch="hardenedbsd/main"
revfile="${installdir}"/.portzap
commitfile="${installdir}"/.portzap
##
# functions
@ -71,7 +71,7 @@ case $1 in
;;
"install")
require_dependency git doas
"${libexec}"/commands/portzap-install "${gitdir}" "${installdir}" "${revfile}"
"${libexec}"/commands/portzap-install "${gitdir}" "${installdir}" "${commitfile}"
;;
*)
printf "Usage: portzap 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/portzap
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/portzap
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}")