haproxy: Rework hotplug script for HAProxy 10442/head
authorChristian Lachner <gladiac@gmail.com>
Sat, 2 Nov 2019 11:50:36 +0000 (12:50 +0100)
committerChristian Lachner <gladiac@gmail.com>
Sun, 3 Nov 2019 11:36:27 +0000 (12:36 +0100)
- The old hotplug script caused long boot-times for r7800 and
  possibly others. The new script is now only triggered by iface
  changes for wan and lan interfaces.

Signed-off-by: Christian Lachner <gladiac@gmail.com>
net/haproxy/Makefile
net/haproxy/files/haproxy.hotplug

index 3e891f418d228bddfbf1ec9766875544cecc400b..0d0cbcd4eba8646af186d431d8d21dd92710e4e4 100644 (file)
@@ -172,8 +172,8 @@ define Package/haproxy/install
        $(INSTALL_CONF) ./files/haproxy.cfg $(1)/etc/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/haproxy.init $(1)/etc/init.d/haproxy
-       $(INSTALL_DIR) $(1)/etc/hotplug.d/net
-       $(INSTALL_BIN) ./files/haproxy.hotplug $(1)/etc/hotplug.d/net/90-haproxy
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/haproxy.hotplug $(1)/etc/hotplug.d/iface/90-haproxy
 endef
 
 Package/haproxy-nossl/install = $(Package/haproxy/install)
index bfb5d6da122fb68755c3a2ec40379225cdc93851..5913918a1df95b84592a9be01777b49cb5ba64a8 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-if [ "$ACTION" = add ]; then
+[ "$INTERFACE" == "wan" ] || [ "$INTERFACE" == "lan" ] || return
+[ "$ACTION" == "ifup" ] &&
        /etc/init.d/haproxy enabled && \
                /etc/init.d/haproxy start
-fi