Add libexec/portzap/utils/get-umask
Some checks are pending
portzap / shellcheck (push) Waiting to run
Some checks are pending
portzap / shellcheck (push) Waiting to run
This commit is contained in:
parent
7c4bff14a2
commit
a38962782f
5 changed files with 20 additions and 5 deletions
|
@ -6,6 +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
|
||||||
|
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 \
|
||||||
|
|
6
libexec/portzap/utils/get-umask
Normal file
6
libexec/portzap/utils/get-umask
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
##
|
||||||
|
# main
|
||||||
|
echo "u=rwX,g=rX,o="
|
|
@ -3,11 +3,13 @@ set -e
|
||||||
|
|
||||||
##
|
##
|
||||||
# variables
|
# variables
|
||||||
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
|
libexec="${localbase}"/libexec/portzap
|
||||||
git=$(which git)
|
git=$(which git)
|
||||||
mode=u=rwX,g=rX,o=
|
mask=$("${libexec}"/utils/get-umask)
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
doas -n \
|
doas -n \
|
||||||
-u _portzap \
|
-u _portzap \
|
||||||
/bin/sh -c "umask ${mode}; ${git} ${*}"
|
/bin/sh -c "umask ${mask}; ${git} ${*}"
|
||||||
|
|
|
@ -3,12 +3,14 @@ set -e
|
||||||
|
|
||||||
##
|
##
|
||||||
# variables
|
# variables
|
||||||
mode=u=rwX,g=rX,o=
|
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)}
|
||||||
|
libexec="${localbase}"/libexec/portzap
|
||||||
|
mask=$("${libexec}"/utils/get-umask)
|
||||||
|
|
||||||
##
|
##
|
||||||
# main
|
# main
|
||||||
install -o root \
|
install -o root \
|
||||||
-g _portzap \
|
-g _portzap \
|
||||||
-m "${mode}" \
|
-m "${mask}" \
|
||||||
-v \
|
-v \
|
||||||
"${@}"
|
"${@}"
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
* vNEXT
|
* vNEXT
|
||||||
|
|
||||||
|
** Add 'libexec/portzap/utils/get-umask'
|
||||||
|
Add a single source of truth for the mask given to umask
|
||||||
|
by git and portzap-install
|
||||||
|
|
||||||
** Break up 'portzap-install' into multiple files
|
** Break up 'portzap-install' into multiple files
|
||||||
'libexec/portzap/utils/install/' contains files that cover both
|
'libexec/portzap/utils/install/' contains files that cover both
|
||||||
a fresh install and applying an update
|
a fresh install and applying an update
|
||||||
|
|
Loading…
Reference in a new issue