Fix bad .jriver permissions more gracefully

This commit is contained in:
2025-07-11 20:55:24 -04:00
parent f2d08bc3e6
commit d62f844371

View File

@@ -21,7 +21,7 @@
# shellcheck disable=SC2317 # shellcheck disable=SC2317
shopt -s extglob shopt -s extglob
declare -g SCRIPT_VERSION="1.34.4-dev" declare -g SCRIPT_VERSION="1.34.4"
declare -g MC_VERSION="34.0.42" # do find all replace (hardcoded fallback) declare -g MC_VERSION="34.0.42" # do find all replace (hardcoded fallback)
declare -g MC_REPO="bookworm" # should match the MC_VERSION declare -g MC_REPO="bookworm" # should match the MC_VERSION
declare -g BOARD_ID="89.0" # MC34 board ID for automatic version detection declare -g BOARD_ID="89.0" # MC34 board ID for automatic version detection
@@ -1590,9 +1590,15 @@ service_jriver-createrepo() {
fix_dotjriver_permissions() { fix_dotjriver_permissions() {
debug "${FUNCNAME[0]}()" debug "${FUNCNAME[0]}()"
# Ensure the user owns the .jriver directory # Ensure the user owns their .jriver directory
[[ -d "$HOME/.jriver" ]] && execute sudo chown -R "$USER:$USER" "$HOME/.jriver" if [[ -d "$HOME/.jriver" ]]; then
local owner
owner=$(stat -c '%U' "$HOME/.jriver")
if [[ "$owner" != "$USER" ]]; then
ask_ok "$USER does not currently own $HOME/.jriver, attempt fix?" &&
execute sudo chown -R "$USER:$USER" "$HOME/.jriver"
fi
fi
} }
# @description Completely uninstalls MC, services, and firewall rules # @description Completely uninstalls MC, services, and firewall rules