kiss: Use as_root for git pulls

This commit is contained in:
Dylan Araps 2020-01-30 10:52:25 +02:00
parent fa1538fb13
commit f8d35ce2b5
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

16
kiss
View File

@ -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,7 +1134,7 @@ args() {
*)
case $@ in
*'*'*|*'!'*|*'['*|*']'*)
*'*'*|*'!'*|*'['*|*']'*|*' '*)
die "Arguments contain invalid characters: '!*[] '"
;;
esac