haproxy: Rework hotplug script for HAProxy 10515/head
authorChristian Lachner <gladiac@gmail.com>
Fri, 8 Nov 2019 13:38:31 +0000 (14:38 +0100)
committerChristian Lachner <gladiac@gmail.com>
Sun, 10 Nov 2019 10:04:48 +0000 (11:04 +0100)
- Migrated init-script to procd.
- Removed the old hotplug script as it is unnecessary and
  caused long boot-times for r7800 and possibly others.

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

index 3e891f418d228bddfbf1ec9766875544cecc400b..50a631a38fe52d2118209c90e4d76995416f7df0 100644 (file)
@@ -172,8 +172,6 @@ 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
 endef
 
 Package/haproxy-nossl/install = $(Package/haproxy/install)
diff --git a/net/haproxy/files/haproxy.hotplug b/net/haproxy/files/haproxy.hotplug
deleted file mode 100644 (file)
index bfb5d6d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ "$ACTION" = add ]; then
-       /etc/init.d/haproxy enabled && \
-               /etc/init.d/haproxy start
-fi
-
index 52bc126ac2d1b8a5bd101ddf43d5db078a041763..de5695204eb0061f451f49e5b5d1ff1e590c40fa 100644 (file)
@@ -1,29 +1,25 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2009-2010 OpenWrt.org
+# Copyright (C) 2009-2019 OpenWrt.org
 
 START=99
 STOP=80
 
-SERVICE_USE_PID=1
+USE_PROCD=1
+
 EXTRA_COMMANDS="check"
 
 HAPROXY_BIN="/usr/sbin/haproxy"
 HAPROXY_CONFIG="/etc/haproxy.cfg"
-HAPROXY_PID="/var/run/haproxy.pid"
-
-start() {
-       service_start $HAPROXY_BIN -q -D -f "$HAPROXY_CONFIG" -p "$HAPROXY_PID"
-}
-
-stop() {
-       kill -9 $(cat $HAPROXY_PID | tr "\n" " ")
-       service_stop $HAPROXY_BIN
-}
 
-reload() {
-       $HAPROXY_BIN -D -q -f $HAPROXY_CONFIG -p $HAPROXY_PID -sf $(cat $HAPROXY_PID)
+start_service() {
+       procd_open_instance
+       procd_set_param respawn
+       procd_set_param file "$HAPROXY_CONFIG"
+       procd_set_param reload_signal USR2
+       procd_set_param command $HAPROXY_BIN -q -W -db -f "$HAPROXY_CONFIG"
+       procd_close_instance
 }
 
 check() {
-        $HAPROXY_BIN -c -q -V -f $HAPROXY_CONFIG
+       $HAPROXY_BIN -c -q -V -f $HAPROXY_CONFIG
 }