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")"/../../..)} localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/sourcezap libexec="${localbase}"/libexec/sourcezap
git="${libexec}"/utils/git/run git="${libexec}"/utils/git/run
mask=$("${libexec}"/utils/get-umask)
gitdir=$1 gitdir=$1
installdir=$2 installdir=$2
revfile=$3 revfile=$3
@ -33,7 +34,7 @@ if [ -e "${revfile}" ]; then
else else
## ##
# install from scratch # install from scratch
umask u=rwX,g=rX,o= umask "${mask}"
"${libexec}"/utils/install/run -d "${installdir}" "${libexec}"/utils/install/run -d "${installdir}"
find -s . \ find -s . \
-maxdepth 1 \ -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 # variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
libexec="${localbase}"/libexec/sourcezap
git=$(which git) git=$(which git)
mode=u=rwX,g=rX,o= mask=$("${libexec}"/utils/get-umask)
## ##
# main # main
doas -n \ doas -n \
-u _sourcezap \ -u _sourcezap \
/bin/sh -c "umask ${mode}; ${git} ${*}" /bin/sh -c "umask ${mask}; ${git} ${*}"

View file

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

View file

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