From: Florian Eckert Date: Mon, 16 Dec 2024 14:35:12 +0000 (+0100) Subject: keepalived: only add content to config file if needed X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=1d79439834de5052f9defca4d0d4b9f57621eff4;p=openwrt-packages.git keepalived: only add content to config file if needed Only add the first two pieces of information to the configuration file if there is a valid '/etc/config/keepalived'. Signed-off-by: Florian Eckert --- diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index c017a679f..20535a4b5 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -600,11 +600,6 @@ process_config() { local alt_config_file linkbeat_use_polling rm -f "$KEEPALIVED_CONF" - - # First line - printf '! Configuration file for keepalived (autogenerated via init script)\n' > "$KEEPALIVED_CONF" - printf '! Written %s\n\n' "$(date +'%c')" >> "$KEEPALIVED_CONF" - [ -f /etc/config/keepalived ] || return 0 config_load 'keepalived' config_get alt_config_file globals alt_config_file @@ -617,6 +612,10 @@ process_config() { return 0 } + # First line + printf '! Configuration file for keepalived (autogenerated via init script)\n' > "$KEEPALIVED_CONF" + printf '! Written %s\n\n' "$(date +'%c')" >> "$KEEPALIVED_CONF" + config_get_bool linkbeat_use_polling globals linkbeat_use_polling 0 [ "$linkbeat_use_polling" -gt 0 ] && printf 'linkbeat_use_polling\n\n' >> "$KEEPALIVED_CONF"