Add libexec/sourcezap/utils/get-umask
Some checks are pending
sourcezap / shellcheck (push) Waiting to run

This commit is contained in:
0x1eef 2024-08-20 00:24:03 -03:00
parent cc4debc134
commit 74c34a9491
5 changed files with 20 additions and 5 deletions

View file

@ -6,6 +6,7 @@ set -e
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run
mask=$("${libexec}"/utils/get-umask)
gitdir=$1
installdir=$2
revfile=$3
@ -33,7 +34,7 @@ if [ -e "${revfile}" ]; then
else
##
# install from scratch
umask u=rwX,g=rX,o=
umask "${mask}"
"${libexec}"/utils/install/run -d "${installdir}"
find -s . \
-maxdepth 1 \

View file

@ -0,0 +1,6 @@
#!/bin/sh
set -e
##
# main
echo "u=rwX,g=rX,o="

View file

@ -3,11 +3,13 @@ set -e
##
# variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
libexec="${localbase}"/libexec/sourcezap
git=$(which git)
mode=u=rwX,g=rX,o=
mask=$("${libexec}"/utils/get-umask)
##
# main
doas -n \
-u _sourcezap \
/bin/sh -c "umask ${mode}; ${git} ${*}"
/bin/sh -c "umask ${mask}; ${git} ${*}"

View file

@ -3,12 +3,14 @@ set -e
##
# variables
mode=u=rwX,g=rX,o=
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
libexec="${localbase}"/libexec/sourcezap
mask=$("${libexec}"/utils/get-umask)
##
# main
install -o root \
-g _sourcezap \
-m "${mode}" \
-m "${mask}" \
-v \
"${@}"

View file

@ -1,5 +1,9 @@
* vNEXT
** 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
'libexec/sourcezap/utils/install/' contains files that cover both
a fresh install and applying an update