diff --git a/package/ctcgfw/gost/Makefile b/package/ctcgfw/gost/Makefile index e62371d51c..b60d34545c 100644 --- a/package/ctcgfw/gost/Makefile +++ b/package/ctcgfw/gost/Makefile @@ -52,6 +52,10 @@ endef define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/gost $(1)/usr/bin/gost + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(CURDIR)/files/gost.config $(1)/etc/config/gost + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(CURDIR)/files/gost.init $(1)/etc/init.d/gost endef $(eval $(call GoBinPackage,$(PKG_NAME))) diff --git a/package/ctcgfw/luci-app-gost/root/etc/config/gost b/package/ctcgfw/gost/files/gost.config similarity index 100% rename from package/ctcgfw/luci-app-gost/root/etc/config/gost rename to package/ctcgfw/gost/files/gost.config diff --git a/package/ctcgfw/gost/files/gost.init b/package/ctcgfw/gost/files/gost.init new file mode 100644 index 0000000000..bdf00b4eb7 --- /dev/null +++ b/package/ctcgfw/gost/files/gost.init @@ -0,0 +1,36 @@ +#!/bin/sh /etc/rc.common +# Created By [CTCGFW]Project OpenWRT +# https://github.com/project-openwrt + +START=99 +STOP=10 + +USE_PROCD=1 + +enable="$(uci get gost.@gost[0].enable)" +run_command="$(uci get gost.@gost[0].run_command)" + +start_service() { + [ "${enable}" -ne "1" ] && exit 0 + procd_open_instance gost + procd_set_param command /usr/bin/gost + procd_append_param command ${run_command} + + procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} + + procd_set_param limits core="unlimited" + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance +} + +reload_service() +{ + stop + start +} + +service_triggers() +{ + procd_add_reload_trigger "gost" +} diff --git a/package/ctcgfw/luci-app-gost/root/etc/init.d/gost b/package/ctcgfw/luci-app-gost/root/etc/init.d/gost deleted file mode 100755 index 423673e839..0000000000 --- a/package/ctcgfw/luci-app-gost/root/etc/init.d/gost +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh /etc/rc.common -# Created By [CTCGFW]Project OpenWRT -# https://github.com/project-openwrt - -START=90 -STOP=10 - -enable="$(uci get gost.@gost[0].enable)" -run_command="$(uci get gost.@gost[0].run_command)" - -start() -{ - stop - - [ "${enable}" -ne "1" ] && exit 0 - /usr/bin/gost ${run_command} & -} - -stop() -{ - killall -9 "gost" > "/dev/null" 2>&1 -}