diff --git a/libexec/portzap/portzap-clone b/libexec/portzap/portzap-clone index c612ae8..1b384c6 100755 --- a/libexec/portzap/portzap-clone +++ b/libexec/portzap/portzap-clone @@ -8,6 +8,7 @@ git="${localbase}"/bin/git giturl=$1 gitdir=$2 branch=$3 +mode="u=rwX,g=rwX,o=" ## # main @@ -23,11 +24,17 @@ if [ -e "${gitdir}/.git" ]; then fi set -x -umask u=rwX,g=rwX,o= +umask "${mode}" doas -u _portzap "${git}" clone "${giturl}" "${gitdir}" cd "${gitdir}" doas -u _portzap "${git}" config core.filemode off -set +x +e -echo "[-] Checkout ${branch}" -doas -u _portzap "${git}" checkout -t origin/"${branch}" > /dev/null 2>&1; -echo "[-] Done" +echo "[-] git checkout ${branch}" +if ! doas -u _portzap "${git}" \ + checkout -t \ + origin/"${branch}" \ + > /dev/null 2>&1; then + echo "[-] 'git checkout' exited with an error" + exit "${?}" +else + echo "[-] Done" +fi diff --git a/libexec/portzap/portzap-pull b/libexec/portzap/portzap-pull index 45395f1..0e8b1bb 100755 --- a/libexec/portzap/portzap-pull +++ b/libexec/portzap/portzap-pull @@ -22,7 +22,7 @@ change_branch() if ! doas -u _portzap "${git}" checkout "${branch}" > /dev/null 2>&1 || doas -u _portzap "${git}" checkout -t "${remote}"/"${branch}" > /dev/null 2>&1; then echo "[-] 'git checkout' exited with an error" - exit 1 + exit "${?}" else echo "[-] Done" fi