s|gitdir|repodir|g, s|giturl|repourl|g
This commit is contained in:
parent
7e4aa19c96
commit
218dbcad15
10 changed files with 33 additions and 33 deletions
|
@ -6,7 +6,7 @@ set -e
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
git="${libexec}"/utils/git/run
|
git="${libexec}"/utils/git/run
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
branch=$2
|
branch=$2
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -26,12 +26,12 @@ if ! "${libexec}"/utils/isportzap-member; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${gitdir}/.git" ]; then
|
if [ ! -e "${repodir}/.git" ]; then
|
||||||
printerr "try 'portzap clone' instead"
|
printerr "try 'portzap clone' instead"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
"${git}" fetch origin
|
"${git}" fetch origin
|
||||||
"${git}" checkout "${branch}" ||
|
"${git}" checkout "${branch}" ||
|
||||||
"${git}" checkout -t origin/"${branch}"
|
"${git}" checkout -t origin/"${branch}"
|
||||||
|
|
|
@ -6,8 +6,8 @@ set -e
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
git="${libexec}"/utils/git/run
|
git="${libexec}"/utils/git/run
|
||||||
giturl=$1
|
repourl=$1
|
||||||
gitdir=$2
|
repodir=$2
|
||||||
branch=$3
|
branch=$3
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -27,13 +27,13 @@ if ! "${libexec}"/utils/isportzap-member; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "${gitdir}/.git" ]; then
|
if [ -e "${repodir}/.git" ]; then
|
||||||
printerr "try 'portzap pull' instead"
|
printerr "try 'portzap pull' instead"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"${git}" clone "${giturl}" "${gitdir}"
|
"${git}" clone "${repourl}" "${repodir}"
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
"${git}" config core.filemode off
|
"${git}" config core.filemode off
|
||||||
"${git}" checkout -t origin/"${branch}" > /dev/null 2>&1 || true
|
"${git}" checkout -t origin/"${branch}" > /dev/null 2>&1 || true
|
||||||
printok "clone complete"
|
printok "clone complete"
|
||||||
|
|
|
@ -7,7 +7,7 @@ localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
git="${libexec}"/utils/git/run
|
git="${libexec}"/utils/git/run
|
||||||
mask=$("${libexec}"/utils/get-umask)
|
mask=$("${libexec}"/utils/get-umask)
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
revfile=$3
|
revfile=$3
|
||||||
|
|
||||||
|
@ -23,14 +23,14 @@ if [ "$(id -u)" != "0" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
if [ -e "${revfile}" ]; then
|
if [ -e "${revfile}" ]; then
|
||||||
##
|
##
|
||||||
# install update
|
# install update
|
||||||
rev=$(cat "${revfile}")
|
rev=$(cat "${revfile}")
|
||||||
"${libexec}"/utils/install/run -d "${installdir}"
|
"${libexec}"/utils/install/run -d "${installdir}"
|
||||||
"${libexec}"/utils/install/update-deleted-files "${gitdir}" "${installdir}" "${rev}"
|
"${libexec}"/utils/install/update-deleted-files "${repodir}" "${installdir}" "${rev}"
|
||||||
"${libexec}"/utils/install/update-changed-files "${gitdir}" "${installdir}" "${rev}"
|
"${libexec}"/utils/install/update-changed-files "${repodir}" "${installdir}" "${rev}"
|
||||||
else
|
else
|
||||||
##
|
##
|
||||||
# install from scratch
|
# install from scratch
|
||||||
|
|
|
@ -6,7 +6,7 @@ set -e
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
git="${libexec}"/utils/git/run
|
git="${libexec}"/utils/git/run
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
|
|
||||||
##
|
##
|
||||||
# functions
|
# functions
|
||||||
|
@ -25,12 +25,12 @@ if ! "${libexec}"/utils/isportzap-member; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${gitdir}/.git" ]; then
|
if [ ! -e "${repodir}/.git" ]; then
|
||||||
printerr "try 'portzap clone' instead"
|
printerr "try 'portzap clone' instead"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
branch=$("${git}" branch --show-current)
|
branch=$("${git}" branch --show-current)
|
||||||
"${git}" pull --rebase origin "${branch}"
|
"${git}" pull --rebase origin "${branch}"
|
||||||
printok "pull complete"
|
printok "pull complete"
|
||||||
|
|
|
@ -5,7 +5,7 @@ set -e
|
||||||
# variables
|
# variables
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -34,19 +34,19 @@ if [ "$(id -u)" != "0" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "1 Remove the contents of %s\n" "${gitdir}"
|
printf "1 Remove the contents of %s\n" "${repodir}"
|
||||||
printf "2 Remove the contents of %s\n" "${installdir}"
|
printf "2 Remove the contents of %s\n" "${installdir}"
|
||||||
printf "3 Remove the contents of both (%s and %s)\n" "${gitdir}" "${installdir}"
|
printf "3 Remove the contents of both (%s and %s)\n" "${repodir}" "${installdir}"
|
||||||
printf "4 Do nothing\n"
|
printf "4 Do nothing\n"
|
||||||
printf "1-4: "
|
printf "1-4: "
|
||||||
while true; do
|
while true; do
|
||||||
read -r r
|
read -r r
|
||||||
if [ "${r}" = "1" ]; then
|
if [ "${r}" = "1" ]; then
|
||||||
erase "${gitdir}"
|
erase "${repodir}"
|
||||||
elif [ "${r}" = "2" ]; then
|
elif [ "${r}" = "2" ]; then
|
||||||
erase "${installdir}"
|
erase "${installdir}"
|
||||||
elif [ "${r}" = "3" ]; then
|
elif [ "${r}" = "3" ]; then
|
||||||
erase "${gitdir}"
|
erase "${repodir}"
|
||||||
erase "${installdir}"
|
erase "${installdir}"
|
||||||
elif [ "${r}" = "4" ]; then
|
elif [ "${r}" = "4" ]; then
|
||||||
break
|
break
|
||||||
|
|
|
@ -6,7 +6,7 @@ set -e
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
user=_portzap
|
user=_portzap
|
||||||
gitdir="${1}"
|
repodir="${1}"
|
||||||
|
|
||||||
##
|
##
|
||||||
# functions
|
# functions
|
||||||
|
@ -25,12 +25,12 @@ if ! "${libexec}"/utils/isportzap-member; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "${gitdir}" ]; then
|
if [ ! -e "${repodir}" ]; then
|
||||||
printerr "try 'portzap clone' instead"
|
printerr "try 'portzap clone' instead"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
doas -n \
|
doas -n \
|
||||||
-u "${user}" \
|
-u "${user}" \
|
||||||
/bin/sh
|
/bin/sh
|
||||||
|
|
|
@ -6,11 +6,11 @@ set -e
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
git="${libexec}"/utils/git/run
|
git="${libexec}"/utils/git/run
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
commit=$2
|
commit=$2
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
"${git}" diff -l0 --name-only --diff-filter=A "${commit}" "HEAD"
|
"${git}" diff -l0 --name-only --diff-filter=A "${commit}" "HEAD"
|
||||||
"${git}" diff -l0 --name-only --diff-filter=M "${commit}" "HEAD"
|
"${git}" diff -l0 --name-only --diff-filter=M "${commit}" "HEAD"
|
||||||
|
|
|
@ -6,10 +6,10 @@ set -e
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
git="${libexec}"/utils/git/run
|
git="${libexec}"/utils/git/run
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
commit=$2
|
commit=$2
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
"${git}" diff -l0 --name-only --diff-filter=D "${commit}" "HEAD"
|
"${git}" diff -l0 --name-only --diff-filter=D "${commit}" "HEAD"
|
||||||
|
|
|
@ -5,14 +5,14 @@ set -e
|
||||||
# variables
|
# variables
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
rev=$3
|
rev=$3
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
files=$("${libexec}"/utils/git/get-changed-files "${gitdir}" "${rev}")
|
files=$("${libexec}"/utils/git/get-changed-files "${repodir}" "${rev}")
|
||||||
for file in ${files}; do
|
for file in ${files}; do
|
||||||
target="${installdir}/${file}"
|
target="${installdir}/${file}"
|
||||||
parent=$(dirname "${target}")
|
parent=$(dirname "${target}")
|
||||||
|
|
|
@ -5,14 +5,14 @@ set -e
|
||||||
# variables
|
# variables
|
||||||
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
libexec="${localbase}"/libexec/portzap
|
libexec="${localbase}"/libexec/portzap
|
||||||
gitdir=$1
|
repodir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
rev=$3
|
rev=$3
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
cd "${gitdir}"
|
cd "${repodir}"
|
||||||
files=$("${libexec}"/utils/git/get-removed-files "${gitdir}" "${rev}")
|
files=$("${libexec}"/utils/git/get-removed-files "${repodir}" "${rev}")
|
||||||
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