1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update luci-haproxy-tcp

This commit is contained in:
Ycarus 2018-02-28 12:16:51 +01:00
parent 34d27e1361
commit 07d8b89305
3 changed files with 7 additions and 71 deletions

View file

@ -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 <chenhw2@github.com>
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

View file

@ -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")})

View file

@ -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