From 71697f63bf9483e5bc2d5309b149bb31b156cf06 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Wed, 10 Sep 2025 20:54:07 +0000 Subject: [PATCH] fix: preserve config files during reinstalls to prevent threshold loss (addresses #429) - Modified install.sh to avoid recursive chown on /etc/pulse during reinstalls - This prevents custom thresholds in alerts.json from being lost during updates - Only changes directory ownership, not existing file permissions - Explicitly preserves permissions on critical config files --- install.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 9e09b3033..91724a878 100755 --- a/install.sh +++ b/install.sh @@ -1310,13 +1310,22 @@ download_pulse() { setup_directories() { print_info "Setting up directories..." - # Create directories + # Create directories (only if they don't exist) mkdir -p "$CONFIG_DIR" mkdir -p "$INSTALL_DIR" - # Set permissions - chown -R pulse:pulse "$CONFIG_DIR" "$INSTALL_DIR" + # Set permissions (preserve existing files) + # Use chown without -R on CONFIG_DIR to avoid changing existing file permissions + chown pulse:pulse "$CONFIG_DIR" + chown -R pulse:pulse "$INSTALL_DIR" chmod 700 "$CONFIG_DIR" + + # Ensure critical config files retain proper permissions if they exist + for config_file in "$CONFIG_DIR"/alerts.json "$CONFIG_DIR"/system.json "$CONFIG_DIR"/*.enc; do + if [[ -f "$config_file" ]]; then + chown pulse:pulse "$config_file" + fi + done } setup_update_command() {