index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Levente Polyak <anthraxx@archlinux.org> | 2023-05-20 00:20:41 +0200 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2023-05-20 00:20:41 +0200 |
commit | 41d4624879d01b1269d6af9c1440592a15ad7784 (patch) | |
tree | 51dddceb749e2cb8c8bfbe9138cc58fb604b0d94 /src/lib | |
parent | 4d3ab0b489f05565cec0a741564f8ba6ec57a9d6 (diff) |
-rw-r--r-- | src/lib/archroot.sh | 5 |
diff --git a/src/lib/archroot.sh b/src/lib/archroot.sh index d7917da..3f48dc1 100644 --- a/src/lib/archroot.sh +++ b/src/lib/archroot.sh @@ -9,13 +9,14 @@ CHROOT_VERSION='v4' ## # usage : check_root $keepenv ## -orig_argv=("${BASH_SOURCE[0]}" "$@") check_root() { local keepenv=$1 + shift + local orig_argv=("$@") (( EUID == 0 )) && return if type -P sudo >/dev/null; then - exec sudo --preserve-env=$keepenv -- "${orig_argv[@]}" + exec sudo --preserve-env="${keepenv}" -- "${orig_argv[@]}" else exec su root -c "$(printf ' %q' "${orig_argv[@]}")" fi |