From 07d8b893050453e3d99dfc787f35483ea8a5f6c0 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Wed, 28 Feb 2018 12:16:51 +0100 Subject: [PATCH] Update luci-haproxy-tcp --- luci-app-haproxy-tcp/Makefile | 70 +------------------ .../luasrc/model/cbi/haproxy-tcp.lua | 2 +- .../root/etc/init.d/haproxy-tcp | 6 +- 3 files changed, 7 insertions(+), 71 deletions(-) diff --git a/luci-app-haproxy-tcp/Makefile b/luci-app-haproxy-tcp/Makefile index 765a69389..aac05e085 100644 --- a/luci-app-haproxy-tcp/Makefile +++ b/luci-app-haproxy-tcp/Makefile @@ -7,75 +7,11 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=luci-app-haproxy-tcp -PKG_VERSION:=0.1.4 -PKG_RELEASE:=1 +LUCI_TITLE:=LuCI Support for haproxy-tcp +LUCI_DEPENDS:=+haproxy-nossl PKG_LICENSE:=MIT -PKG_LICENSE_FILES:=LICENSE -PKG_MAINTAINER:=chenhw2 - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) include ../luci/luci.mk -define Package/luci-app-haproxy-tcp - SECTION:=luci - CATEGORY:=LuCI - SUBMENU:=3. Applications - TITLE:=LuCI Support for HAProxy-TCP - PKGARCH:=all - DEPENDS:=+haproxy-nossl -endef - -define Package/luci-app-haproxy-tcp/description - LuCI Support for HAProxy-TCP. -endef - -define Build/Configure -endef - -define Build/Compile -endef - -define Package/luci-app-haproxy-tcp/postinst -#!/bin/sh -if [ -z "$${IPKG_INSTROOT}" ]; then - if [ -f /etc/uci-defaults/luci-haproxy-tcp ]; then - ( . /etc/uci-defaults/luci-haproxy-tcp ) && \ - rm -f /etc/uci-defaults/luci-haproxy-tcp - fi - rm -rf /tmp/luci-indexcache /tmp/luci-modulecache -fi -exit 0 -endef - -define Package/luci-app-haproxy-tcp/prerm -#!/bin/sh -/etc/init.d/haproxy-tcp disable -/etc/init.d/haproxy-tcp stop -rm -f /usr/sbin/haproxy-tcp -rm -f /etc/hotplug.d/net/90-haproxy -exit 0 -endef - -define Package/luci-app-haproxy-tcp/conffiles -/etc/config/haproxy-tcp -endef - -define Package/luci-app-haproxy-tcp/install - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller - $(INSTALL_DATA) ./luasrc/controller/*.lua $(1)/usr/lib/lua/luci/controller/ - $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi - $(INSTALL_DATA) ./luasrc/model/cbi/*.lua $(1)/usr/lib/lua/luci/model/cbi/ - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./root/etc/config/haproxy-tcp $(1)/etc/config/haproxy-tcp - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./root/etc/init.d/haproxy-tcp $(1)/etc/init.d/haproxy-tcp - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./root/etc/uci-defaults/luci-haproxy-tcp $(1)/etc/uci-defaults/luci-haproxy-tcp - $(INSTALL_DIR) $(1)/usr/sbin - $(LN) haproxy $(1)/usr/sbin/haproxy-tcp -endef - -$(eval $(call BuildPackage,luci-app-haproxy-tcp)) +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-haproxy-tcp/luasrc/model/cbi/haproxy-tcp.lua b/luci-app-haproxy-tcp/luasrc/model/cbi/haproxy-tcp.lua index 37b1ad3cb..ce1775afb 100644 --- a/luci-app-haproxy-tcp/luasrc/model/cbi/haproxy-tcp.lua +++ b/luci-app-haproxy-tcp/luasrc/model/cbi/haproxy-tcp.lua @@ -1,6 +1,6 @@ local m, s, o -if luci.sys.call("pgrep haproxy-tcp >/dev/null") == 0 then +if luci.sys.call("pgrep haproxy >/dev/null") == 0 then m = Map("haproxy-tcp", translate("HAProxy-TCP"), "%s - %s" %{translate("HAProxy-TCP"), translate("RUNNING")}) else m = Map("haproxy-tcp", translate("HAProxy-TCP"), "%s - %s" %{translate("HAProxy-TCP"), translate("NOT RUNNING")}) diff --git a/luci-app-haproxy-tcp/root/etc/init.d/haproxy-tcp b/luci-app-haproxy-tcp/root/etc/init.d/haproxy-tcp index b5c799b0c..c7c0dd836 100644 --- a/luci-app-haproxy-tcp/root/etc/init.d/haproxy-tcp +++ b/luci-app-haproxy-tcp/root/etc/init.d/haproxy-tcp @@ -5,7 +5,7 @@ START=85 USE_PROCD=1 -PROG_NAME=haproxy-tcp +PROG_NAME=haproxy PROG=/usr/sbin/${PROG_NAME} PIDCOUNT=0 @@ -77,9 +77,9 @@ start_instance() { default_backend tcp-out backend tcp-out - $( if [ 0 -lt $(grep -c weight /etc/config/$PROG_NAME) ]; then + $( if [ 0 -lt $(grep -c weight /etc/config/haproxy-tcp) ]; then echo " balance static-rr" - sed -n 's/.*upstreams[\t ]*//p' /etc/config/$PROG_NAME | + sed -n 's/.*upstreams[\t ]*//p' /etc/config/haproxy-tcp | while read upstream; do genline_srv "$upstream" done