From a184c01ef649b427040f04c54333dc87f8d20772 Mon Sep 17 00:00:00 2001 From: pvincent Date: Tue, 18 Aug 2026 12:59:16 +0400 Subject: [PATCH] install2 --- lib/functions.bash | 6 +++++- lib/self-upgrade.bash | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/functions.bash b/lib/functions.bash index 7a025d4..7f14795 100644 --- a/lib/functions.bash +++ b/lib/functions.bash @@ -1,5 +1,9 @@ ## library of useful functions, usually prefixed with '_' +function sudo_root { + [[ "$UID" -ne 0 ]] && sudo -vp 'SUDO privilege required: ' +} + ## ASSERT Functions function assert_root { @@ -16,7 +20,7 @@ function assert_system_mode { >&2 echo "ERROR: development mode: $(realpath "$MIAOU_BASH_DIR")" && return 3 - assert_container && [[ ! -w $MIAOU_BASH_DIR ]] && + assert_container && ! sudo test -w "$MIAOU_BASH_DIR" && >&2 echo "ERROR: hosted mode" && return 4 diff --git a/lib/self-upgrade.bash b/lib/self-upgrade.bash index f5767fb..b0baaa3 100644 --- a/lib/self-upgrade.bash +++ b/lib/self-upgrade.bash @@ -22,6 +22,7 @@ function self_upgrade { # MAIN source "$MIAOU_BASH_DIR"/lib/functions.bash +sudo_root assert_system_mode current=$(miaou-bash --version)