armbian-next: exec into sudo when relaunching (AR-1452)

- with `exec`, `sudo` replaces the current shell, and thus never returns
This commit is contained in:
Ricardo Pardini 2023-01-03 13:07:40 +01:00
parent a3c64bb6e7
commit 093e60d111
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02

View File

@ -211,8 +211,9 @@ function cli_standard_relaunch_docker_or_sudo() {
display_alert "This script requires root privileges; Docker is unavailable" "trying to use sudo" "wrn"
declare -g ARMBIAN_CLI_RELAUNCH_ARGS=()
produce_relaunch_parameters # produces ARMBIAN_CLI_RELAUNCH_ARGS
sudo --preserve-env "${SRC}/compile.sh" "${ARMBIAN_CLI_RELAUNCH_ARGS[@]}" # MARK: relaunch done here!
produce_relaunch_parameters # produces ARMBIAN_CLI_RELAUNCH_ARGS
# shellcheck disable=SC2093 # re-launching under sudo: replace the current shell, and never return.
exec sudo --preserve-env "${SRC}/compile.sh" "${ARMBIAN_CLI_RELAUNCH_ARGS[@]}" # MARK: relaunch done here!
display_alert "AFTER SUDO!!!" "AFTER SUDO!!!" "warn"
fi
}