Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
revert: order arguments after as_user.
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanaraps committed Jul 24, 2021
1 parent be1f5ef commit 3108ca2
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions kiss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3108ca2

Please sign in to comment.