s|rev|commit|g, s|revfile|commitfile|g
Some checks failed
portzap / shellcheck (push) Has been cancelled
Some checks failed
portzap / shellcheck (push) Has been cancelled
This commit is contained in:
parent
218dbcad15
commit
2039076720
4 changed files with 12 additions and 12 deletions
|
@ -9,7 +9,7 @@ gitdir="/home/_portzap/ports"
|
||||||
giturl="${PORTZAP_CLONEURL:-https://git.hardenedbsd.org/hardenedbsd/ports.git}"
|
giturl="${PORTZAP_CLONEURL:-https://git.hardenedbsd.org/hardenedbsd/ports.git}"
|
||||||
installdir="${PORTZAP_INSTALLDIR:-/usr/ports}"
|
installdir="${PORTZAP_INSTALLDIR:-/usr/ports}"
|
||||||
defaultbranch="hardenedbsd/main"
|
defaultbranch="hardenedbsd/main"
|
||||||
revfile="${installdir}"/.portzap
|
commitfile="${installdir}"/.portzap
|
||||||
|
|
||||||
##
|
##
|
||||||
# functions
|
# functions
|
||||||
|
@ -71,7 +71,7 @@ case $1 in
|
||||||
;;
|
;;
|
||||||
"install")
|
"install")
|
||||||
require_dependency git doas
|
require_dependency git doas
|
||||||
"${libexec}"/commands/portzap-install "${gitdir}" "${installdir}" "${revfile}"
|
"${libexec}"/commands/portzap-install "${gitdir}" "${installdir}" "${commitfile}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "Usage: portzap COMMAND [OPTIONS]\n"
|
printf "Usage: portzap COMMAND [OPTIONS]\n"
|
||||||
|
|
|
@ -9,7 +9,7 @@ git="${libexec}"/utils/git/run
|
||||||
mask=$("${libexec}"/utils/get-umask)
|
mask=$("${libexec}"/utils/get-umask)
|
||||||
repodir=$1
|
repodir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
revfile=$3
|
commitfile=$3
|
||||||
|
|
||||||
##
|
##
|
||||||
# functions
|
# functions
|
||||||
|
@ -24,13 +24,13 @@ if [ "$(id -u)" != "0" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${repodir}"
|
cd "${repodir}"
|
||||||
if [ -e "${revfile}" ]; then
|
if [ -e "${commitfile}" ]; then
|
||||||
##
|
##
|
||||||
# install update
|
# install update
|
||||||
rev=$(cat "${revfile}")
|
commit=$(cat "${commitfile}")
|
||||||
"${libexec}"/utils/install/run -d "${installdir}"
|
"${libexec}"/utils/install/run -d "${installdir}"
|
||||||
"${libexec}"/utils/install/update-deleted-files "${repodir}" "${installdir}" "${rev}"
|
"${libexec}"/utils/install/update-deleted-files "${repodir}" "${installdir}" "${commit}"
|
||||||
"${libexec}"/utils/install/update-changed-files "${repodir}" "${installdir}" "${rev}"
|
"${libexec}"/utils/install/update-changed-files "${repodir}" "${installdir}" "${commit}"
|
||||||
else
|
else
|
||||||
##
|
##
|
||||||
# install from scratch
|
# install from scratch
|
||||||
|
@ -52,5 +52,5 @@ else
|
||||||
-exec cp -Rpv {} "${installdir}" \;
|
-exec cp -Rpv {} "${installdir}" \;
|
||||||
chown -Rv root "${installdir}"
|
chown -Rv root "${installdir}"
|
||||||
fi
|
fi
|
||||||
"${git}" rev-parse HEAD > "${revfile}"
|
"${git}" rev-parse HEAD > "${commitfile}"
|
||||||
printok "install complete"
|
printok "install complete"
|
||||||
|
|
|
@ -7,12 +7,12 @@ localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
repodir=$1
|
repodir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
rev=$3
|
commit=$3
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
cd "${repodir}"
|
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
|
for file in ${files}; do
|
||||||
target="${installdir}/${file}"
|
target="${installdir}/${file}"
|
||||||
parent=$(dirname "${target}")
|
parent=$(dirname "${target}")
|
||||||
|
|
|
@ -7,12 +7,12 @@ localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
repodir=$1
|
repodir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
rev=$3
|
commit=$3
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
cd "${repodir}"
|
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
|
for file in ${files}; do
|
||||||
target="${installdir}"/"${file}"
|
target="${installdir}"/"${file}"
|
||||||
parent=$(dirname "${target}")
|
parent=$(dirname "${target}")
|
||||||
|
|
Loading…
Reference in a new issue