Run chmod after clone

The umask appears to be ignored (maybe it is reset after running
'git config core.filemode off' ?). Run chmod to fix.
This commit is contained in:
0x1eef 2024-04-20 01:40:13 -03:00
parent c1a76f5f88
commit 1739b7d794
3 changed files with 6 additions and 3 deletions

View file

@ -27,7 +27,10 @@ set -x
umask ${mode} umask ${mode}
doas -u _portzap "${git}" clone "${giturl}" "${gitdir}" doas -u _portzap "${git}" clone "${giturl}" "${gitdir}"
cd "${gitdir}" cd "${gitdir}"
set +x
echo "[-] Adjust filemode. This might take a while"
doas -u _portzap "${git}" config core.filemode off doas -u _portzap "${git}" config core.filemode off
doas -u root /bin/chmod -R ${mode} "${gitdir}"
echo "[-] git checkout ${branch}" echo "[-] git checkout ${branch}"
if ! doas -u _portzap "${git}" \ if ! doas -u _portzap "${git}" \
checkout -t \ checkout -t \

View file

@ -51,7 +51,7 @@ 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}"
echo "[-] Adjust filemode for new branch. This might take a while" echo "[-] Adjust filemode. This might take a while"
doas -u root /bin/chmod -R "${mode}" "${gitdir}" doas -u root /bin/chmod -R "${mode}" "${gitdir}"
fi fi
set -x set -x

View file

@ -2,6 +2,6 @@
# portzap # portzap
permit nopass root as _portzap cmd /usr/local/bin/git permit nopass root as _portzap cmd /usr/local/bin/git
permit nopass :_portzap as _portzap cmd /usr/local/bin/git permit nopass :_portzap as _portzap cmd /usr/local/bin/git
permit nopass :_portzap as root cmd /bin/chmod args -R u=rwX,g=rwX,o= /home/_portzap/ports permit nopass :_portzap as root cmd /bin/chmod args -R ug=rwX,o= /home/_portzap/ports
permit nopass :_portzap as root cmd /bin/chmod args -R u=rwX,g=rwX,o= /home/_portzap/ports/.git permit nopass :_portzap as root cmd /bin/chmod args -R ug=rwX,o= /home/_portzap/ports/.git
permit nopass :_portzap as root cmd /usr/sbin/chown args -R _portzap:_portzap /home/_portzap/ports/.git permit nopass :_portzap as root cmd /usr/sbin/chown args -R _portzap:_portzap /home/_portzap/ports/.git