From f8d35ce2b5c51e95abf4328882908b81d1842884 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 30 Jan 2020 10:52:25 +0200 Subject: [PATCH] kiss: Use as_root for git pulls --- kiss | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/kiss b/kiss index 35816db..c02c031 100755 --- a/kiss +++ b/kiss @@ -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/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