mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-12-12 22:38:50 +00:00
fix: enhance user switching logic in installation script for non-interactive mode
- Added a check to skip re-execution of the script as the 'debros' user when running in non-interactive mode. - Ensured that the installation can proceed as root without switching users in non-interactive scenarios, improving usability.
This commit is contained in:
parent
38e77c79c6
commit
46d69baf63
@ -52,8 +52,12 @@ check_and_setup_debros_user() {
|
||||
|
||||
# If running as root via sudo from debros user, that's also okay for proceeding with installation
|
||||
if [ "$CURRENT_USER" = "root" ] && [ "$SUDO_USER" = "$DEBROS_USER" ]; then
|
||||
# Switch back to debros user to run the installation properly
|
||||
exec sudo -u "$DEBROS_USER" bash "$SCRIPT_PATH"
|
||||
# Skip re-exec in non-interactive mode (piped script)
|
||||
if [ "$NON_INTERACTIVE" != true ]; then
|
||||
# Switch back to debros user to run the installation properly
|
||||
exec sudo -u "$DEBROS_USER" bash "$SCRIPT_PATH"
|
||||
fi
|
||||
# In non-interactive mode, just proceed as root (user already explicitly used sudo)
|
||||
fi
|
||||
|
||||
# If not debros user and not root, abort and give instructions
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user