revert: order arguments after as_user.

This commit is contained in:
Dylan Araps 2021-07-24 23:38:46 +03:00
parent be1f5efb98
commit 3108ca2d71
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
1 changed files with 29 additions and 29 deletions

58
kiss
View File

@ -1672,35 +1672,6 @@ args() {
action=$1
shift "$(($# != 0))"
# Need to increment _KISS_LVL here to ensure we don't wipe the cache
# early by non-asroot invocations.
export _KISS_LVL=$((_KISS_LVL + 1))
# Rerun the script as root with a fixed environment if needed. We sadly
# can't run singular functions as root so this is needed.
#
# Intended behavior.
# shellcheck disable=2030,2031
case $action in a|alternatives|i|install|r|remove)
if ok "$1" && ! am_owner "$KISS_ROOT/"; then
as_user env \
LOGNAME="$user" \
HOME="$HOME" \
XDG_CACHE_HOME="$XDG_CACHE_HOME" \
KISS_COMPRESS="$KISS_COMPRESS" \
KISS_PATH="$KISS_PATH" \
KISS_FORCE="$KISS_FORCE" \
KISS_ROOT="$KISS_ROOT" \
KISS_CHOICE="$KISS_CHOICE" \
KISS_COLOR="$KISS_COLOR" \
KISS_TMPDIR="$KISS_TMPDIR" \
KISS_PID="$KISS_PID" \
_KISS_LVL="$_KISS_LVL" \
"$0" "$action" "$@"
return
fi
esac
# Ensure that arguments do not contain invalid characters. Wildcards can
# not be used here as they would conflict with kiss extensions.
case $action in
@ -1739,6 +1710,35 @@ args() {
;;
esac
# Need to increment _KISS_LVL here to ensure we don't wipe the cache
# early by non-asroot invocations.
export _KISS_LVL=$((_KISS_LVL + 1))
# Rerun the script as root with a fixed environment if needed. We sadly
# can't run singular functions as root so this is needed.
#
# Intended behavior.
# shellcheck disable=2030,2031
case $action in a|alternatives|i|install|r|remove)
if ok "$1" && ! am_owner "$KISS_ROOT/"; then
as_user env \
LOGNAME="$user" \
HOME="$HOME" \
XDG_CACHE_HOME="$XDG_CACHE_HOME" \
KISS_COMPRESS="$KISS_COMPRESS" \
KISS_PATH="$KISS_PATH" \
KISS_FORCE="$KISS_FORCE" \
KISS_ROOT="$KISS_ROOT" \
KISS_CHOICE="$KISS_CHOICE" \
KISS_COLOR="$KISS_COLOR" \
KISS_TMPDIR="$KISS_TMPDIR" \
KISS_PID="$KISS_PID" \
_KISS_LVL="$_KISS_LVL" \
"$0" "$action" "$@"
return
fi
esac
# Actions can be abbreviated to their first letter. This saves keystrokes
# once you memorize the commands.
case $action in