fix sudo elevation

master
David Kebler 2024-02-27 19:37:44 -08:00
parent 4b957f1e4b
commit 140404ff49
1 changed files with 2 additions and 2 deletions

View File

@ -7,10 +7,10 @@ uci_bash_shell_install () {
# export BASH_SHELL_BASE="$(dirname "$(cd "$(dirname "${BASH_SOURCE:-$0}")" >/dev/null 2>&1 ; pwd -P )")" # export BASH_SHELL_BASE="$(dirname "$(cd "$(dirname "${BASH_SOURCE:-$0}")" >/dev/null 2>&1 ; pwd -P )")"
echo "Detected The UCI BASH Shell install directory: BASH_INSTALL_DIR=$install_dir" echo "Detected The UCI BASH Shell install directory: BASH_INSTALL_DIR=$install_dir"
echo "Detected The UCI BASH Shell base directory: BASH_SHELL_BASE=$BASH_SHELL_BASE" echo "Detected The UCI BASH Shell base directory: BASH_SHELL_BASE=$BASH_SHELL_BASE"
[[ $EUID -ne 0 ]] && usesudo="sudo -E" [[ $EUID -ne 0 ]] && ( usesudo="sudo -E" && echo $USER elevated to sudo )
$usesudo $SHELL $install_dir/scripts/copy-etc.sh $usesudo $SHELL $install_dir/scripts/copy-etc.sh
$usesudo $SHELL $install_dir/scripts/copy-root.sh $usesudo $SHELL $install_dir/scripts/copy-root.sh
[[ $1 ]] && [[ $(id -u $1 2> /dev/null) ]] && $usesudo -E $SHELL $install_dir/scripts/copy-user.sh "$@" [[ $1 ]] && [[ $(id -u $1 2> /dev/null) ]] && $usesudo $SHELL $install_dir/scripts/copy-user.sh "$@"
} }
# # if script was executed then call the function # # if script was executed then call the function