diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-30 08:52:25 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-30 08:52:25 +0000 |
commit | 6355643ed68379bad585e35ef5b1eac60b2b48bb (patch) | |
tree | ac2e8c0709dd443e73eb41f447bb1a2c2aef74fb /kiss | |
parent | 5fa575ed4cb03cbe3185e196ebe46ad9dbebf29d (diff) | |
download | cpt-6355643ed68379bad585e35ef5b1eac60b2b48bb.tar.gz |
kiss: Use as_root for git pulls
FossilOrigin-Name: fa812b5811ca2dd56a7d606b6895adc7486ab65e0e5ac2ef0c7d1add1f948988
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -53,8 +53,8 @@ as_root() { log "Using '${su:-su}'" case $su in - *sudo) sudo -u "${user:-root}" -E "$@" ;; - *doas) doas -u "${user:-root}" "$@" ;; + *sudo) sudo -u "${user:-root}" -E sh -c "$*" ;; + *doas) doas -u "${user:-root}" sh -c "$*" ;; *) su -pc "$* <&3" "${user:-root}" 3<&0 </dev/tty ;; esac @@ -1038,15 +1038,7 @@ pkg_updates() { else log "$PWD" "Need root to update" - if command -v sudo >/dev/null; then - sudo git fetch - sudo git merge - elif command -v doas >/dev/null; then - doas git fetch - doas git merge - else - su -c 'git fetch && git merge' - fi + as_root 'git fetch && git merge' fi } done @@ -1142,8 +1134,8 @@ args() { *) case $@ in - *'*'*|*'!'*|*'['*|*']'*) - die "Arguments contain invalid characters: '!*[]'" + *'*'*|*'!'*|*'['*|*']'*|*' '*) + die "Arguments contain invalid characters: '!*[] '" ;; esac esac |