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
This commit is contained in:
Pulse Monitor
2025-09-10 20:54:07 +00:00
parent 9d905a356c
commit 71697f63bf
+12 -3
View File
@@ -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() {