Add libexec/portzap/utils/gitexec

This commit is contained in:
0x1eef 2024-05-23 01:51:21 -03:00
parent f4c45cd481
commit 7bf64d5abc
7 changed files with 25 additions and 24 deletions

View file

@ -5,8 +5,6 @@ set -e
# variables # variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap libexec="${localbase}"/libexec/portzap
git=$(which git)
mode=u=rwX,g=rX,o=
gitdir="$1" gitdir="$1"
branch="$2" branch="$2"
@ -14,8 +12,7 @@ branch="$2"
# functions # functions
gitexec() gitexec()
{ {
doas -n -u _portzap \ "${libexec}"/utils/gitexec "${1}"
/bin/sh -c "umask ${mode}; ${git} ${1}"
} }
printok() { printok() {

View file

@ -5,8 +5,6 @@ set -e
# variables # variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap libexec="${localbase}"/libexec/portzap
git=$(which git)
mode=u=rwX,g=rX,o=
giturl=$1 giturl=$1
gitdir=$2 gitdir=$2
branch=$3 branch=$3
@ -15,8 +13,7 @@ branch=$3
# functions # functions
gitexec() gitexec()
{ {
doas -n -u _portzap \ "${libexec}"/utils/gitexec "${1}"
/bin/sh -c "umask ${mode}; ${git} ${1}"
} }
printok() { printok() {

View file

@ -5,16 +5,13 @@ set -e
# variables # variables
localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
libexec="${localbase}"/libexec/portzap libexec="${localbase}"/libexec/portzap
git=$(which git)
mode=u=rwX,g=rX,o=
gitdir=$1 gitdir=$1
## ##
# functions # functions
gitexec() gitexec()
{ {
doas -n -u _portzap \ "${libexec}"/utils/gitexec "${1}"
/bin/sh -c "umask ${mode}; ${git} ${1}"
} }
printok() { printok() {

View file

@ -3,8 +3,8 @@ set -e
## ##
# variables # variables
git=$(which git) localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
mode=u=rwX,g=rX,o= libexec="${localbase}"/libexec/portzap
gitdir=$1 gitdir=$1
commit=$2 commit=$2
@ -12,8 +12,7 @@ commit=$2
# functions # functions
gitexec() gitexec()
{ {
doas -n -u _portzap \ "${libexec}"/utils/gitexec "${1}"
/bin/sh -c "umask ${mode}; ${git} ${1}"
} }
## ##

View file

@ -3,8 +3,8 @@ set -e
## ##
# variables # variables
git=$(which git) localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
mode=u=rwX,g=rX,o= libexec="${localbase}"/libexec/portzap
gitdir=$1 gitdir=$1
commit=$2 commit=$2
@ -12,8 +12,7 @@ commit=$2
# functions # functions
gitexec() gitexec()
{ {
doas -n -u _portzap \ "${libexec}"/utils/gitexec "${1}"
/bin/sh -c "umask ${mode}; ${git} ${1}"
} }
## ##

View file

@ -3,16 +3,15 @@ set -e
## ##
# variables # variables
git=$(which git) localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)}
mode=u=rwX,g=rX,o= libexec="${localbase}"/libexec/portzap
gitdir=$1 gitdir=$1
## ##
# functions # functions
gitexec() gitexec()
{ {
doas -n -u _portzap \ "${libexec}"/utils/gitexec "${1}"
/bin/sh -c "umask ${mode}; ${git} ${1}"
} }
## ##

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e
##
# variables
git=$(which git)
mode=u=rwx,g=rx,o=
##
# main
doas -n \
-u _portzap \
/bin/sh -c "umask ${mode}; ${git} ${1}"