Add ${mode}, ${owner} to portzap-pull

This commit is contained in:
0x1eef 2024-04-19 07:48:54 -03:00
parent 1572ea4c1d
commit 2c85e47fdb

View file

@ -7,6 +7,8 @@ localbase=${LOCALBASE:-/usr/local}
git="${localbase}"/bin/git git="${localbase}"/bin/git
gitdir=$1 gitdir=$1
branch=$2 branch=$2
mode="u=rwX,g=rwX,o="
owner="_portzap:_portzap"
## ##
# functions # functions
@ -37,14 +39,15 @@ if [ ! -e "${gitdir}/.git" ]; then
exit 1 exit 1
fi fi
umask u=rwX,g=rwX,o= umask "${mode}"
doas -u root /bin/chmod -R u=rwX,g=rwX,o= "${gitdir}/.git" doas -u root /bin/chmod -R "${mode}" "${gitdir}/.git"
doas -u root /usr/sbin/chown -R _portzap:_portzap "${gitdir}/.git" doas -u root /usr/sbin/chown -R "${owner}" "${gitdir}/.git"
cd "${gitdir}" cd "${gitdir}"
remote=$("${git}" remote | head -n1) remote=$("${git}" remote | head -n1)
if [ "$(git branch --show-current)" != "${branch}" ]; then if [ "$(git branch --show-current)" != "${branch}" ]; then
change_branch "${remote}" "${branch}" change_branch "${remote}" "${branch}"
doas -u root /bin/chmod -R u=rwX,g=rwX,o= "${gitdir}" echo "[-] Set filemode. This might take a while"
doas -u root /bin/chmod -R "${mode}" "${gitdir}"
fi fi
set -x set -x
doas -u _portzap "${git}" pull --rebase "${remote}" "${branch}" doas -u _portzap "${git}" pull --rebase "${remote}" "${branch}"