From 81231050888363f4f5e8880552f0369c15df20fa Mon Sep 17 00:00:00 2001 From: pvincent Date: Wed, 2 Sep 2026 14:06:10 +0400 Subject: [PATCH] fix sudo_root for root --- lib/functions.bash | 3 ++- lib/self-upgrade.bash | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/functions.bash b/lib/functions.bash index 1254b01..b500c49 100644 --- a/lib/functions.bash +++ b/lib/functions.bash @@ -1,7 +1,8 @@ ## library of useful functions, usually prefixed with '_' function sudo_root { - [[ "$UID" -ne 0 ]] && sudo -vp 'SUDO privilege required: ' 2>/dev/null + [[ $UID == 0 ]] && return + sudo -vp 'SUDO privilege required: ' 2>/dev/null } ## ASSERT Functions diff --git a/lib/self-upgrade.bash b/lib/self-upgrade.bash index b20de64..17ca7e2 100644 --- a/lib/self-upgrade.bash +++ b/lib/self-upgrade.bash @@ -19,7 +19,7 @@ function container_upgrade { fi echo ' (Ctrl-c to bypass)' if sudo_root; then - sudo -E miaou-bash "$MIAOU_BASH_DIR"/lib/initiate.bash + sudo -E "$MIAOU_BASH_DIR"/bin/miaou-bash "$MIAOU_BASH_DIR"/lib/initiate.bash else builtin exit 1 fi @@ -56,7 +56,7 @@ function system_upgrade { if [[ "$current" == "$latest" ]]; then echo "up-to-date version: $current (Ctrl-c to bypass reinitialization)" if sudo_root; then - sudo miaou-bash "$MIAOU_BASH_DIR"/lib/initiate.bash + sudo -E "$MIAOU_BASH_DIR"/bin/miaou-bash "$MIAOU_BASH_DIR"/lib/initiate.bash else builtin exit 1 fi