From: Francesco Benini Date: Sat, 19 Oct 2024 22:36:07 +0000 (+0200) Subject: keepalived: add option to override service running check X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=ea092363d93ea74799a610d2ac2e6710ae0dd3e2;p=openwrt-packages.git keepalived: add option to override service running check Some init.d scripts like firewall and sqm do not return the actual state of the service if called with "running" parameter. This result in the init script called with "start" parameter and the service may not load the new configuration. Firewall init script is one of this An option is added in order to skip the "running" check for the service. Signed-off-by: Francesco Benini --- diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile index f020e11f8..21ec9f73d 100644 --- a/net/keepalived/Makefile +++ b/net/keepalived/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=keepalived PKG_VERSION:=2.2.8 -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.keepalived.org/software diff --git a/net/keepalived/files/etc/hotplug.d/keepalived/511-firewall b/net/keepalived/files/etc/hotplug.d/keepalived/511-firewall index d8619e9f1..b85a70381 100644 --- a/net/keepalived/files/etc/hotplug.d/keepalived/511-firewall +++ b/net/keepalived/files/etc/hotplug.d/keepalived/511-firewall @@ -5,6 +5,7 @@ set_service_name firewall +set_skip_running_check set_reload_if_sync add_sync_file /etc/config/firewall diff --git a/net/keepalived/files/lib/functions/keepalived/hotplug.sh b/net/keepalived/files/lib/functions/keepalived/hotplug.sh index 8691872c6..57db374e2 100644 --- a/net/keepalived/files/lib/functions/keepalived/hotplug.sh +++ b/net/keepalived/files/lib/functions/keepalived/hotplug.sh @@ -31,17 +31,17 @@ _service() { [ ! -x "$rc" ] && return case $1 in - start) $rc running || $rc start ;; - stop) $rc running && $rc stop ;; + start) _service_running_check "$rc" || $rc start ;; + stop) _service_running_check "$rc" && $rc stop ;; reload) - if $rc running; then + if _service_running_check "$rc"; then $rc reload else $rc start fi ;; restart) - if $rc running; then + if _service_running_check "$rc"; then $rc restart else $rc start @@ -50,6 +50,10 @@ _service() { esac } +_service_running_check() { + skip_running_check || "$1" running +} + _start_service() { _service start } @@ -158,6 +162,14 @@ backup_and_stop() { get_var_flag NOTIFY_BACKUP_STOP 1 } +set_skip_running_check() { + set_var NOTIFY_SKIP_RUNNING 1 +} + +skip_running_check() { + get_var_flag NOTIFY_SKIP_RUNNING +} + set_reload_if_sync() { set_var NOTIFY_SYNC_RELOAD "${1:-1}" }