forked from kiss-community/kiss
kiss: Allow option of setting sudo command
This commit is contained in:
parent
51d9e82230
commit
546110a1c0
19
kiss
19
kiss
@ -50,14 +50,13 @@ prompt() {
|
|||||||
|
|
||||||
as_root() {
|
as_root() {
|
||||||
[ "$(id -u)" = 0 ] || {
|
[ "$(id -u)" = 0 ] || {
|
||||||
if command -v sudo >/dev/null; then
|
log "Using '${su:-su}'"
|
||||||
sudo -E KISS_FORCE="$KISS_FORCE" "$@"
|
|
||||||
elif command -v doas >/dev/null; then
|
case $su in
|
||||||
KISS_FORCE="$KISS_FORCE" doas "$@"
|
*sudo) sudo -E KISS_FORCE="$KISS_FORCE" "$@" ;;
|
||||||
else
|
*doas) KISS_FORCE="$KISS_FORCE" doas "$@" ;;
|
||||||
exec 3<&0
|
*) su -pc "KISS_FORCE=$KISS_FORCE $* <&3" 3<&0 </dev/tty ;;
|
||||||
su -pc "KISS_FORCE=$KISS_FORCE $* <&3" </dev/tty
|
esac
|
||||||
fi
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -1318,6 +1317,10 @@ main() {
|
|||||||
# POSIX correctness.
|
# POSIX correctness.
|
||||||
grep=$(command -v ggrep) || grep='grep'
|
grep=$(command -v ggrep) || grep='grep'
|
||||||
|
|
||||||
|
# Figure out which 'sudo' command to use based on the user's choice or
|
||||||
|
# what is available on the system.
|
||||||
|
su=${KISS_SU:-$(command -v sudo || command -v doas)} || su=su
|
||||||
|
|
||||||
# Store the date and time of script invocation to be used as the name
|
# Store the date and time of script invocation to be used as the name
|
||||||
# of the log files the package manager creates uring builds.
|
# of the log files the package manager creates uring builds.
|
||||||
time=$(date '+%d-%m-%Y-%H:%M')
|
time=$(date '+%d-%m-%Y-%H:%M')
|
||||||
|
Loading…
Reference in New Issue
Block a user