Skip to content
33 changes: 33 additions & 0 deletions cross/ddns-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
PKG_NAME = ddns-go
PKG_VERS = 6.12.4
WEB_VERSION = $(PKG_VERS)
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/jeessy2/ddns-go/archive
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

BUILD_DEPENDS = native/go

# lacking support for atomics
UNSUPPORTED_ARCHS = $(ARMv5_ARCHS)
# not supported by go
UNSUPPORTED_ARCHS += $(PPC_ARCHS)

HOMEPAGE = https://github.com/jeessy2/ddns-go
COMMENT = Automatically obtain your public IPv4 or IPv6 address and resolve it to the corresponding domain name service.
LICENSE = MIT

COMPILE_TARGET = ddns-go_compile_target
INSTALL_TARGET = ddns-go_install

include ../../mk/spksrc.cross-go.mk

.PHONY: ddns-go_compile_target
ddns-go_compile_target:
@$(RUN) $(MAKE) VERSION=v$(PKG_VERS) BUILD_TIME="$$(date -u +'%Y-%m-%dT%H:%M:%SZ')" build

.PHONY: ddns-go_install
ddns-go_install:
@mkdir -p $(STAGING_INSTALL_PREFIX)/bin
@install -m 755 $(WORK_DIR)/$(PKG_DIR)/ddns-go $(STAGING_INSTALL_PREFIX)/bin/
1 change: 1 addition & 0 deletions cross/ddns-go/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin:bin/ddns-go
3 changes: 3 additions & 0 deletions cross/ddns-go/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ddns-go-6.12.4.tar.gz SHA1 4731a73e3736b6fb43d5291ef2b147a69f9d1924
ddns-go-6.12.4.tar.gz SHA256 04f65f7f1ccc18b23dd108f915810146e8b655cd19e7d8ee488cf557222c3fee
ddns-go-6.12.4.tar.gz MD5 35b1b7404ea1d802e63e475757fa50a6
36 changes: 36 additions & 0 deletions spk/ddns-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SPK_NAME = ddns-go
SPK_VERS = 6.12.4
SPK_REV = 1
SPK_ICON = src/ddns-go.png

DEPENDS = cross/ddns-go

UNSUPPORTED_ARCHS = $(ARMv5_ARCHS)
# not supported by go:
UNSUPPORTED_ARCHS += $(PPC_ARCHS)

MAINTAINER = GrandDuke1106
DESCRIPTION = Automatically obtain your public IPv4 or IPv6 address and resolve it to the corresponding domain name service.
DISPLAY_NAME = ddns-go
CHANGELOG = "Initial package release."

HOMEPAGE = https://github.com/jeessy2/ddns-go
LICENSE = MIT

SERVICE_SETUP = src/service-setup.sh

STARTABLE = yes
SERVICE_USER = auto
SERVICE_PORT = 9876
ADMIN_PORT = $(SERVICE_PORT)

WIZARDS_TEMPLATES_DIR = src/wizard_templates

POST_STRIP_TARGET = ddns_go_extra_install

include ../../mk/spksrc.spk.mk

.PHONY: ddns_go_extra_install
ddns_go_extra_install:
@install -d -m 755 $(STAGING_DIR)/var
@install -m 644 src/environment-variables $(STAGING_DIR)/var/
Binary file added spk/ddns-go/src/ddns-go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions spk/ddns-go/src/environment-variables
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Define environment variables for ddns-go parameters configuration
#
# If you want to change the startup parameters after installation,
# you can modify the following variables
#
# example:
#DDNS_GO_FREQUENCY=300
#DDNS_GO_CACHETIMES=5
42 changes: 42 additions & 0 deletions spk/ddns-go/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
DDNS_GO="${SYNOPKG_PKGDEST}/bin/ddns-go -l :${SERVICE_PORT}"
CONFIG_FILE="${SYNOPKG_PKGVAR}/config.yaml"

SVC_BACKGROUND=yes
SVC_WRITE_PID=yes

# The following content refers to the service-setup.sh file in the minio package.
INST_ETC="/var/packages/${SYNOPKG_PKGNAME}/etc"
INST_VARIABLES="${INST_ETC}/installer-variables"
ENV_VARIABLES="${SYNOPKG_PKGVAR}/environment-variables"

service_postinst ()
{
if [ -n "${wizard_frequency}" ] && [ -n "${wizard_cachetimes}" ]; then
echo "DDNS_GO_FREQUENCY=${wizard_frequency}" > ${INST_VARIABLES}
echo "DDNS_GO_CACHETIMES=${wizard_cachetimes}" >> ${INST_VARIABLES}
fi
}

export_variables_from_file ()
{
if [ -n "$1" -a -r "$1" ]; then
while read -r _line; do
if [ "$(echo ${_line} | grep -v ^[/s]*#)" != "" ]; then
_key="$(echo ${_line} | cut --fields=1 --delimiter==)"
_value="$(echo ${_line} | cut --fields=2- --delimiter==)"
export "${_key}=${_value}"
fi
done < "$1"
fi
}

service_prestart ()
{
# Reload wizard variables stored by postinst
export_variables_from_file "${INST_VARIABLES}"

# Load custom variables
export_variables_from_file "${ENV_VARIABLES}"

SERVICE_COMMAND="${DDNS_GO} -c ${CONFIG_FILE} -f ${DDNS_GO_FREQUENCY} -cacheTimes ${DDNS_GO_CACHETIMES}"
}
42 changes: 42 additions & 0 deletions spk/ddns-go/src/wizard_templates/install_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[{
"step_title": "{{{CONFIGURATION_TITLE}}}",
"items": [{
"type": "textfield",
"desc": "{{{FREQUENCY_DESCRIPTION}}}",
"subitems": [{
"key": "wizard_frequency",
"defaultValue": "300",
"desc": "{{{FREQUENCY_LABEL}}}",
"validator": {
"allowBlank": false,
"regex":{
"expr": "/^\\d+$/",
"errorText": "{{{FREQUENCY_ERRORTEXT}}}"
}
}
}
]
},{
"type": "textfield",
"desc": "{{{CACHETIMES_DESCRIPTION}}}",
"subitems": [{
"key": "wizard_cachetimes",
"defaultValue": "5",
"desc": "{{{CACHETIMES_LABEL}}}",
"validator": {
"allowBlank": false,
"regex":{
"expr": "/^\\d+$/",
"errorText": "{{{CACHETIMES_ERRORTEXT}}}"
}
}
}
]
},{
"desc": ""
},{
"desc": "{{{INSTALLATION_NOTES_TITLE}}}{{{INSTALLATION_NOTES_TEXT1}}}{{{INSTALLATION_NOTES_TEXT2}}}"
}
]
}
]
12 changes: 12 additions & 0 deletions spk/ddns-go/src/wizard_templates/install_uifile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CONFIGURATION_TITLE: "Parameters Configuration"
FREQUENCY_DESCRIPTION: "Frequency of obtaining and checking whether the IP address has changed. (Unit: seconds)"
FREQUENCY_LABEL: "Frequency"
FREQUENCY_ERRORTEXT: "Only numbers can be entered."

CACHETIMES_DESCRIPTION: "Cache times define the number of times to skip comparison with DNS service providers when the IP address remains unchanged."
CACHETIMES_LABEL: "Cache times"
CACHETIMES_ERRORTEXT: "Only numbers can be entered."

INSTALLATION_NOTES_TITLE: "<b>Notes</b><br/>"
INSTALLATION_NOTES_TEXT1: "Although using the <code>cachetimes</code> parameter can avoid traffic restrictions imposed by DNS service providers, if you obtain IP addresses via API, you need to be aware of traffic restrictions on the API end.<br/>"
INSTALLATION_NOTES_TEXT2: "If you want to change the startup parameters after installation, you can modify the parameters in the file <code>/var/packages/ddns-go/var/environment-variables</code>."
12 changes: 12 additions & 0 deletions spk/ddns-go/src/wizard_templates/install_uifile_chs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CONFIGURATION_TITLE: "参数配置"
FREQUENCY_DESCRIPTION: "获取并检查IP地址是否发生变化的频率。(单位:秒)"
FREQUENCY_LABEL: "频率"
FREQUENCY_ERRORTEXT: "仅可输入数字"

CACHETIMES_DESCRIPTION: "缓存次数(cachetimes)定义了当IP地址未改变时,跳过与DNS服务提供商比较的次数。"
CACHETIMES_LABEL: "缓存次数"
CACHETIMES_ERRORTEXT: "仅可输入数字"

INSTALLATION_NOTES_TITLE: "<b>注意事项</b><br/>"
INSTALLATION_NOTES_TEXT1: "尽管使用 <code>cachetimes</code> 参数可以避免DNS服务提供商施加的流量限制,但如果您通过接口获取IP地址,则需注意接口的流量限制。<br/>"
INSTALLATION_NOTES_TEXT2: "如果想在安装完成后更改启动参数,可以在 <code>/var/packages/ddns-go/var/environment-variables</code> 这个文件修改。"