Compare commits

..

No commits in common. "892bce5773065b6c2bab0c043cc2495c2a661e80" and "31b7d6ea989a7464a2d65ff962c0fe3ebaa2c85f" have entirely different histories.

13 changed files with 63 additions and 65 deletions

View file

@ -5,11 +5,11 @@ set -e
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/..)}
libexec="${localbase}"/libexec/sourcezap
repodir="/home/_sourcezap/src"
repourl="${SOURCEZAP_CLONEURL:-https://git.hardenedbsd.org/hardenedbsd/hardenedbsd.git}"
gitdir="/home/_sourcezap/src"
giturl="${SOURCEZAP_CLONEURL:-https://git.hardenedbsd.org/hardenedbsd/hardenedbsd.git}"
installdir="${SOURCEZAP_INSTALLDIR:-/usr/src}"
defaultbranch="hardenedbsd/main"
commitfile="${installdir}"/.sourcezap
revfile="${installdir}"/.sourcezap
##
# functions
@ -52,26 +52,26 @@ case $1 in
;;
"clone")
require_dependency git doas
"${libexec}"/commands/sourcezap-clone "${repourl}" "${repodir}" "${defaultbranch}"
"${libexec}"/commands/sourcezap-clone "${giturl}" "${gitdir}" "${defaultbranch}"
;;
"pull")
require_dependency git doas
"${libexec}"/commands/sourcezap-pull "${repodir}"
"${libexec}"/commands/sourcezap-pull "${gitdir}"
;;
"checkout")
require_dependency git doas
"${libexec}"/commands/sourcezap-checkout "${repodir}" "${2}"
"${libexec}"/commands/sourcezap-checkout "${gitdir}" "${2}"
;;
"sh")
require_dependency doas
"${libexec}"/commands/sourcezap-sh "${repodir}"
"${libexec}"/commands/sourcezap-sh "${gitdir}"
;;
"rm")
"${libexec}"/commands/sourcezap-rm "${repodir}" "${installdir}"
"${libexec}"/commands/sourcezap-rm "${gitdir}" "${installdir}"
;;
"install")
require_dependency git doas
"${libexec}"/commands/sourcezap-install "${repodir}" "${installdir}" "${commitfile}"
"${libexec}"/commands/sourcezap-install "${gitdir}" "${installdir}" "${revfile}"
;;
*)
printf "Usage: sourcezap COMMAND [OPTIONS]\n"

View file

@ -6,7 +6,7 @@ set -e
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run
repodir=$1
gitdir=$1
branch=$2
##
@ -26,12 +26,12 @@ if ! "${libexec}"/utils/issourcezap-member; then
exit 1
fi
if [ ! -e "${repodir}/.git" ]; then
if [ ! -e "${gitdir}/.git" ]; then
printerr "try 'sourcezap clone' instead"
exit 1
fi
cd "${repodir}"
cd "${gitdir}"
"${git}" fetch origin
"${git}" checkout "${branch}" ||
"${git}" checkout -t origin/"${branch}"

View file

@ -6,8 +6,8 @@ set -e
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run
repourl=$1
repodir=$2
giturl=$1
gitdir=$2
branch=$3
##
@ -27,13 +27,13 @@ if ! "${libexec}"/utils/issourcezap-member; then
exit 1
fi
if [ -e "${repodir}/.git" ]; then
if [ -e "${gitdir}/.git" ]; then
printerr "try 'sourcezap pull' instead"
exit 1
fi
"${git}" clone "${repourl}" "${repodir}"
cd "${repodir}"
"${git}" clone "${giturl}" "${gitdir}"
cd "${gitdir}"
"${git}" config core.filemode off
"${git}" checkout -t origin/"${branch}" > /dev/null 2>&1 || true
printok "clone complete"

View file

@ -7,9 +7,9 @@ localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run
mask=$("${libexec}"/utils/get-umask)
repodir=$1
gitdir=$1
installdir=$2
commitfile=$3
revfile=$3
##
# functions
@ -23,14 +23,14 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
cd "${repodir}"
if [ -e "${commitfile}" ]; then
cd "${gitdir}"
if [ -e "${revfile}" ]; then
##
# install update
commit=$(cat "${commitfile}")
rev=$(cat "${revfile}")
"${libexec}"/utils/install/run -d "${installdir}"
"${libexec}"/utils/install/update-deleted-files "${repodir}" "${installdir}" "${commit}"
"${libexec}"/utils/install/update-changed-files "${repodir}" "${installdir}" "${commit}"
"${libexec}"/utils/install/update-deleted-files "${gitdir}" "${installdir}" "${rev}"
"${libexec}"/utils/install/update-changed-files "${gitdir}" "${installdir}" "${rev}"
else
##
# install from scratch
@ -52,5 +52,5 @@ else
-exec cp -Rpv {} "${installdir}" \;
chown -Rv root "${installdir}"
fi
"${git}" rev-parse HEAD > "${commitfile}"
"${git}" rev-parse HEAD > "${revfile}"
printok "install complete"

View file

@ -6,7 +6,7 @@ set -e
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run
repodir=$1
gitdir=$1
##
# functions
@ -25,12 +25,12 @@ if ! "${libexec}"/utils/issourcezap-member; then
exit 1
fi
if [ ! -e "${repodir}/.git" ]; then
if [ ! -e "${gitdir}/.git" ]; then
printerr "try 'sourcezap clone' instead"
exit 1
fi
cd "${repodir}"
cd "${gitdir}"
branch=$("${git}" branch --show-current)
"${git}" pull --rebase origin "${branch}"
printok "pull complete"

View file

@ -5,7 +5,7 @@ set -e
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
repodir=$1
gitdir=$1
installdir=$2
##
@ -36,19 +36,19 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
printf "1 Remove the contents of %s\n" "${repodir}"
printf "1 Remove the contents of %s\n" "${gitdir}"
printf "2 Remove the contents of %s\n" "${installdir}"
printf "3 Remove the contents of both (%s and %s)\n" "${repodir}" "${installdir}"
printf "3 Remove the contents of both (%s and %s)\n" "${gitdir}" "${installdir}"
printf "4 Do nothing\n"
printf "1-4: "
while true; do
read -r r
if [ "${r}" = "1" ]; then
erase "${repodir}"
erase "${gitdir}"
elif [ "${r}" = "2" ]; then
erase "${installdir}"
elif [ "${r}" = "3" ]; then
erase "${repodir}"
erase "${gitdir}"
erase "${installdir}"
elif [ "${r}" = "4" ]; then
break

View file

@ -6,7 +6,7 @@ set -e
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
user=_sourcezap
repodir="${1}"
gitdir="${1}"
##
# functions
@ -25,12 +25,12 @@ if ! "${libexec}"/utils/issourcezap-member; then
exit 1
fi
if [ ! -e "${repodir}" ]; then
if [ ! -e "${gitdir}" ]; then
printerr "try 'sourcezap clone' instead"
exit 1
fi
cd "${repodir}"
cd "${gitdir}"
doas -n \
-u "${user}" \
/bin/sh

View file

@ -6,11 +6,11 @@ set -e
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run
repodir=$1
gitdir=$1
commit=$2
##
# main
cd "${repodir}"
cd "${gitdir}"
"${git}" diff -l0 --name-only --diff-filter=A "${commit}" "HEAD"
"${git}" diff -l0 --name-only --diff-filter=M "${commit}" "HEAD"

View file

@ -6,10 +6,10 @@ set -e
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run
repodir=$1
gitdir=$1
commit=$2
##
# main
cd "${repodir}"
cd "${gitdir}"
"${git}" diff -l0 --name-only --diff-filter=D "${commit}" "HEAD"

View file

@ -5,14 +5,14 @@ set -e
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
libexec="${localbase}"/libexec/sourcezap
repodir=$1
gitdir=$1
installdir=$2
commit=$3
rev=$3
##
# main
cd "${repodir}"
files=$("${libexec}"/utils/git/get-changed-files "${repodir}" "${commit}")
cd "${gitdir}"
files=$("${libexec}"/utils/git/get-changed-files "${gitdir}" "${rev}")
for file in ${files}; do
target="${installdir}/${file}"
parent=$(dirname "${target}")

View file

@ -5,14 +5,14 @@ set -e
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
libexec="${localbase}"/libexec/sourcezap
repodir=$1
gitdir=$1
installdir=$2
commit=$3
rev=$3
##
# main
cd "${repodir}"
files=$("${libexec}"/utils/git/get-removed-files "${repodir}" "${commit}")
cd "${gitdir}"
files=$("${libexec}"/utils/git/get-removed-files "${gitdir}" "${rev}")
for file in ${files}; do
target="${installdir}/${file}"
parent=$(dirname "${target}")

View file

@ -1,52 +1,50 @@
# -*- mode: org -*-
* vNEXT
* v1.1.0
**** Add 'libexec/sourcezap/utils/get-umask'
** Add 'libexec/sourcezap/utils/get-umask'
Add a single source of truth for the mask given to umask
by git and sourcezap-install
**** Break up 'sourcezap-install' into multiple files
** Break up 'sourcezap-install' into multiple files
'libexec/sourcezap/utils/install/' contains files that cover both
a fresh install and applying an update
**** Add 'setup/setup-doas' improvements
** Add 'setup/setup-doas' improvements
More likely to do what's expected, but blind spots still exist
**** Add 'sourcezap setup', 'sourcezap teardown'
** Add 'sourcezap setup', 'sourcezap teardown'
Replaces and enhances 'setup-sourcezap'
**** Add 'libexec/sourcezap/commands/sourcezap-sh'
** Add 'libexec/sourcezap/commands/sourcezap-sh'
Runs '/bin/sh' within '/home/_sourcezap/src/' as the '_sourcezap' user
* v1.0.0
**** Add libexec/sourcezap/setup/setup-user
** Add libexec/sourcezap/setup/setup-user
setup-user sets up the '_sourcezap' user and environment
**** Recover from git-checkout failure
** Recover from git-checkout failure
Recover gracefully from git-checkout failure in sourcezap-clone
* v0.2.1
**** Fix Makefile
** Fix Makefile
The mandoc directory wasn't created properly.
It only became obvious when building the port
into a temporary staging directory
* v0.2.0
**** Remove git-diff limit
** Remove git-diff limit
Remove file rename limit from git-diff
**** Replace utils/gitexec with utils/git/run
** Replace utils/gitexec with utils/git/run
Communicate with git via utils/git/run
**** Add utils/git
** Add utils/git
A dedicated directory for git-related scripts
**** Remove "set -x"
** Remove "set -x"
Emit less output
**** Remove scripts
** Remove scripts
Remove utils/printok, utils/printerr, utils/git-rev

View file

@ -1 +1 @@
v1.1.0
v1.0.0