From 0ffcfb573598e247d8c97e0b2983686ce1dd7e16 Mon Sep 17 00:00:00 2001 From: SirPdboy <63764630+sirpdboy@users.noreply.github.com> Date: Sat, 24 Jun 2023 23:17:15 +0800 Subject: [PATCH] =?UTF-8?q?up=20luci-app-ddns-go=201.3.1=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=B7=E6=96=B0=E9=97=B4=E9=9A=94=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ddns-go/Makefile | 45 +++---------------- ddns-go/file/ddns-go.init | 16 ++----- luci-app-ddns-go/Makefile | 4 +- luci-app-ddns-go/luasrc/model/cbi/ddns-go.lua | 3 ++ luci-app-ddns-go/po/zh-cn/ddns-go.po | 4 ++ luci-app-ddns-go/root/etc/config/ddns-go | 3 +- 6 files changed, 21 insertions(+), 54 deletions(-) diff --git a/ddns-go/Makefile b/ddns-go/Makefile index 1c1a3a4..439d353 100644 --- a/ddns-go/Makefile +++ b/ddns-go/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-only # -# Copyright (C) 2021-2023 sirpdboy https://github.com/sirpdboy/luci-app-ddns-go +# Copyright (C) 2021-2023 sirpdboy # # This is free software, licensed under the Apache License, Version 2.0 . # @@ -21,17 +21,12 @@ PKG_LICENSE:=AGPL-3.0-only PKG_LICENSE_FILES:=LICENSE PKG_MAINTAINER:=herboy2008 -PKG_CONFIG_DEPENDS:= \ - CONFIG_DDNS-GO_COMPRESS_GOPROXY \ - CONFIG_DDNS-GO_COMPRESS_UPX - PKG_BUILD_DEPENDS:=golang/host PKG_BUILD_PARALLEL:=1 -PKG_USE_MIPS16:=0 +PKG_BUILD_FLAGS:=no-mips16 GO_PKG:=github.com/jeessy2/ddns-go/v5 -GO_PKG_LDFLAGS:=-s -w -GO_PKG_LDFLAGS_X:=m.version=$(PKG_VERSION) +GO_PKG_LDFLAGS_X:=main.version=$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk @@ -43,6 +38,7 @@ define Package/ddns-go SUBMENU:=Web Servers/Proxies DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle URL:=https://github.com/jeessy2/ddns-go + USERID:=ddns-go:ddns-go endef define Package/$(PKG_NAME)/description @@ -50,44 +46,15 @@ define Package/$(PKG_NAME)/description support Alidns Dnspod Cloudflare Hicloud Callback Baiducloud porkbun GoDaddy Google Domains. endef -define Package/$(PKG_NAME)/config -config DDNS-GO_COMPRESS_GOPROXY - bool "Compiling with GOPROXY proxy" - default n - -config DDNS-GO_COMPRESS_UPX - bool "Compress executable files with UPX" - depends on !mips64 - default n -endef - -ifeq ($(CONFIG_DDNS-GO_COMPRESS_GOPROXY),y) - export GO111MODULE=on - export GOPROXY=https://goproxy.baidu.com -endif - -define Package/$(PKG_NAME)/postinst -#!/bin/sh -if [ -z "$${IPKG_INSTROOT}" ]; then - [ -f /etc/uci-defaults/luci-ddns-go ] && /etc/uci-defaults/luci-ddns-go && rm -f /etc/uci-defaults/luci-ddns-go -fi -endef - -define Build/Compile - $(call GoPackage/Build/Compile) -ifneq ($(CONFIG_DDNS-GO_COMPRESS_UPX),) - $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/ddns-go -endif -endef define Package/$(PKG_NAME)/install $(call GoPackage/Package/Install/Bin,$(1)) $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./file/ddns-go.init $(1)/etc/init.d/ddns-go + $(INSTALL_BIN) $(CURDIR)/file/ddns-go.init $(1)/etc/init.d/ddns-go $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./file/luci-ddns-go.uci-default $(1)/etc/uci-defaults/luci-ddns-go + $(INSTALL_BIN) $(CURDIR)/file/luci-ddns-go.uci-default $(1)/etc/uci-defaults/luci-ddns-go endef $(eval $(call GoBinPackage,ddns-go)) diff --git a/ddns-go/file/ddns-go.init b/ddns-go/file/ddns-go.init index cbda968..d845dc5 100644 --- a/ddns-go/file/ddns-go.init +++ b/ddns-go/file/ddns-go.init @@ -1,6 +1,6 @@ #!/bin/sh /etc/rc.common # -# Copyright (C) 2021-2022 sirpdboy https://github.com/sirpdboy/luci-app-ddns-go +# Copyright (C) 2021-2023 sirpdboy https://github.com/sirpdboy/luci-app-ddns-go # # This file is part of ddns-go . # @@ -13,16 +13,13 @@ USE_PROCD=1 PROG=/usr/bin/ddns-go CONFDIR=/etc/ddns-go -CONF=/etc/ddns-go/ddns-go-config.yaml +CONF=$CONFDIR/ddns-go-config.yaml get_config() { config_get_bool enabled $1 enabled 1 config_get_bool logger $1 logger 1 config_get port $1 port 9876 -} -prepare() { - pgrep -f /usr/bin/ddns-go | xargs kill -9 >/dev/null 2>&1 - logger -t ddns-go -p warn "ddns-go is stop." + config_get time $1 time 300 } init_yaml(){ @@ -30,12 +27,7 @@ init_yaml(){ cat /usr/share/ddns-go/ddns-go-default.yaml > $CONF } -stop_service() { - prepare -} - start_service() { - prepare config_load ddns-go config_foreach get_config basic [ x$enabled == x1 ] || return 1 @@ -43,7 +35,7 @@ start_service() { logger -t ddns-go -p warn "ddns-go is start." echo "ddns-go is start." procd_open_instance - procd_set_param command $PROG -l :$port -f 300 -c "$CONF" + procd_set_param command $PROG -l :$port -f $time -c "$CONF" [ "x$logger" == x1 ] && procd_set_param stderr 1 procd_set_param respawn procd_close_instance diff --git a/luci-app-ddns-go/Makefile b/luci-app-ddns-go/Makefile index 173f642..1abc25a 100644 --- a/luci-app-ddns-go/Makefile +++ b/luci-app-ddns-go/Makefile @@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ddns-go -PKG_VERSION:=1.3.0 -PKG_RELEASE:=9 +PKG_VERSION:=1.3.1 +PKG_RELEASE:=10 LUCI_TITLE:=LuCI Support for Dynamic ddns-go Client LUCI_DEPENDS:=+ddns-go diff --git a/luci-app-ddns-go/luasrc/model/cbi/ddns-go.lua b/luci-app-ddns-go/luasrc/model/cbi/ddns-go.lua index dfb0384..d0cf7e4 100644 --- a/luci-app-ddns-go/luasrc/model/cbi/ddns-go.lua +++ b/luci-app-ddns-go/luasrc/model/cbi/ddns-go.lua @@ -19,6 +19,9 @@ o = s:option(Value, "port",translate("Set the DDNS-TO access port")) o.datatype = "uinteger" o.default=9876 +o = s:option(Value, "time",translate("update interval")) +o.default=300 + m.apply_on_parse = true m.on_after_apply = function(self,map) luci.sys.exec("/etc/init.d/ddns-go restart") diff --git a/luci-app-ddns-go/po/zh-cn/ddns-go.po b/luci-app-ddns-go/po/zh-cn/ddns-go.po index 1f4e535..047e6e0 100644 --- a/luci-app-ddns-go/po/zh-cn/ddns-go.po +++ b/luci-app-ddns-go/po/zh-cn/ddns-go.po @@ -34,3 +34,7 @@ msgstr "
具体使用方法参见:" msgid "Collecting data..." msgstr "收集数据..." +msgid "update interval" +msgstr "更新间隔" + + diff --git a/luci-app-ddns-go/root/etc/config/ddns-go b/luci-app-ddns-go/root/etc/config/ddns-go index 48f9d1c..1237772 100644 --- a/luci-app-ddns-go/root/etc/config/ddns-go +++ b/luci-app-ddns-go/root/etc/config/ddns-go @@ -1,4 +1,5 @@ config basic option enabled '0' option logger '1' - option port 9876 \ No newline at end of file + option port 9876 + option time 300 \ No newline at end of file