diff --git a/lib/functions.bash b/lib/functions.bash index 01f3bf9..b087649 100644 --- a/lib/functions.bash +++ b/lib/functions.bash @@ -21,7 +21,7 @@ function assert_system_mode { >&2 echo "ERROR: development mode: $(realpath "$MIAOU_BASH_DIR")" && return 3 - assert_container && ! sudo test -w "$MIAOU_BASH_DIR" && + assert_container && [[ $(stat -c '%U' "$MIAOU_BASH_DIR") == 'nobody' ]] && >&2 echo "ERROR: hosted mode" && return 4 diff --git a/lib/self-upgrade.bash b/lib/self-upgrade.bash index 896410b..fc683f7 100644 --- a/lib/self-upgrade.bash +++ b/lib/self-upgrade.bash @@ -22,7 +22,6 @@ function self_upgrade { # MAIN source "$MIAOU_BASH_DIR"/lib/functions.bash -sudo_root assert_system_mode current=$("$MIAOU_BASH_DIR"/bin/miaou-bash --version) @@ -30,5 +29,7 @@ latest=$("$MIAOU_BASH_DIR"/tools/wget_semver artcode miaou/miaou-bash) if [[ "$current" == "$latest" ]]; then echo "up-to-date version: $current" else + echo "new version available: $latest" + sudo_root self_upgrade fi