update 2024-02-19 23:40:23

This commit is contained in:
github-actions[bot] 2024-02-19 23:40:23 +08:00
parent f33bbfc34d
commit 9765f92136
2 changed files with 20 additions and 58 deletions

View File

@ -8,18 +8,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ddns-go
KG_VERSION:=6.1.1
PKG_VERSION:=6.1.2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/jeessy2/ddns-go.git
PKG_MIRROR_HASH:=738e16f09df958a8425e19fb717c1d2365632756babea2332e17d500b4ee1266
PKG_SOURCE_VERSION:=6410dad8a20411c75c8eca2026a2588ae355ccb1
PKG_SOURCE_URL:=https://codeload.github.com/jeessy2/ddns-go/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=6a8cb7be152ab398abfe7c63a8069f099f40417c4af0cae97db5dfdb4f81dc57
PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=herboy2008 <herboy2008@gmail.com>
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1

View File

@ -10,26 +10,16 @@
START=99
USE_PROCD=1
NAME=ddns-go
PROG=/usr/bin/ddns-go
CONFDIR=/etc/ddns-go
CONF=$CONFDIR/ddns-go-config.yaml
get_tz()
{
SET_TZ=""
[ -e "/etc/localtime" ] && return
for tzfile in /etc/TZ /var/etc/TZ
do
[ -e "$tzfile" ] || continue
tz="$(cat $tzfile 2>/dev/null)"
done
[ -z "$tz" ] && return
SET_TZ=$tz
get_config() {
config_get_bool enabled $1 enabled 1
config_get_bool logger $1 logger 1
config_get port $1 port 9876
config_get time $1 time 300
}
init_yaml(){
@ -37,46 +27,20 @@ init_yaml(){
cat /usr/share/ddns-go/ddns-go-default.yaml > $CONF
}
xappend() { param="$param $1"; }
append_parm() {
local section="$1"
local option="$2"
local switch="$3"
local default="$4"
local _tmp
config_get _tmp "$section" "$option" "$default"
[[ -z "$_tmp" ]] && return
[[ x$default = x && x$_tmp = x0 ]] && return
[[ x$default = x && x$_tmp = x1 ]] && xappend "$switch" || xappend "$switch $_tmp"
}
start_instance() {
local cfg="$1" param
config_get_bool enabled $cfg enabled 1
[[ x$enabled = x1 ]] || return 1
[[ -s ${CONF} ]] || init_yaml
config_get_bool logger $cfg logger 1
config_get port $cfg port '9876'
append_parm "$cfg" 'time' '-f' '300'
append_parm "$cfg" 'ctimes' '-cacheTimes' '5'
append_parm "$cfg" 'dns' '-dns' '223.5.5.5'
append_parm "$cfg" 'noweb' '-noweb'
append_parm "$cfg" 'skipverify' '-skipVerify'
start_service() {
config_load ddns-go
config_foreach get_config basic
[ x$enabled == x1 ] || return 1
[ -s ${CONF} ] || init_yaml
logger -t ddns-go -p warn "ddns-go is start."
echo "ddns-go is start."
procd_open_instance
get_tz
[[ -z "$SET_TZ" ]] || procd_set_param env TZ="$SET_TZ"
procd_set_param command ${PROG} -l :$port -c "$CONF" ${param}
[[ "x$logger" == x1 ]] && procd_set_param stderr 1
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
}
start_service() {
config_load 'ddns-go'
config_foreach start_instance 'basic'
}
service_triggers() {
procd_add_reload_trigger "ddns-go"
}