diff --git a/cross/cloudflared/Makefile b/cross/cloudflared/Makefile new file mode 100644 index 00000000000..e3bd3092992 --- /dev/null +++ b/cross/cloudflared/Makefile @@ -0,0 +1,23 @@ +PKG_NAME = cloudflared +PKG_VERS = 2022.6.3 +PKG_EXT = tar.gz +PKG_DIST_NAME = $(PKG_VERS).$(PKG_EXT) +PKG_DIST_SITE = https://github.com/cloudflare/cloudflared/archive +PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT) +PKG_DIR = $(PKG_NAME)-$(PKG_VERS) + +BUILD_DEPENDS = native/go + +HOMEPAGE = https://github.com/cloudflare/cloudflared +COMMENT = Cloudflare Tunnel client (formerly Argo Tunnel) +LICENSE = Apache-2.0 + +GO_SRC_DIR = $(WORK_DIR)/$(PKG_NAME)-$(PKG_VERS) +GO_BIN_DIR = $(GO_SRC_DIR)/$(PKG_NAME) +COMPILE_TARGET = cloudflared_compile + +include ../../mk/spksrc.cross-go.mk + +.PHONY: cloudflared_compile +cloudflared_compile: + @$(RUN) $(MAKE) VERSION=$(PKG_VERS) LINK_FLAGS="-s -w" cloudflared diff --git a/cross/cloudflared/PLIST b/cross/cloudflared/PLIST new file mode 100644 index 00000000000..45c18be2e24 --- /dev/null +++ b/cross/cloudflared/PLIST @@ -0,0 +1 @@ +bin:bin/cloudflared diff --git a/cross/cloudflared/digests b/cross/cloudflared/digests new file mode 100644 index 00000000000..2f6929bee71 --- /dev/null +++ b/cross/cloudflared/digests @@ -0,0 +1,3 @@ +cloudflared-2022.6.3.tar.gz SHA1 9bd0a13a8f873edb507d3ffafaa1600facdce73a +cloudflared-2022.6.3.tar.gz SHA256 74fb20e78f69db086f6044eae9d7a09bb3b59001a14d17c18edd9cb4ee8db4f6 +cloudflared-2022.6.3.tar.gz MD5 458f453543f4c400ed16598666866471 diff --git a/spk/cloudflared/Makefile b/spk/cloudflared/Makefile new file mode 100644 index 00000000000..74edcba06e6 --- /dev/null +++ b/spk/cloudflared/Makefile @@ -0,0 +1,23 @@ +SPK_NAME = cloudflared +SPK_VERS = 2022.6.3 +SPK_REV = 1 +SPK_ICON = src/cloudflared.png +DSM_UI_DIR = app + +DEPENDS = cross/$(SPK_NAME) +UNSUPPORTED_ARCHS = $(PPC_ARCHS) + +MAINTAINER = karasevm +DISPLAY_NAME = cloudflared +DESCRIPTION = Cloudflare Tunnel client (formerly Argo Tunnel). +HOMEPAGE = https://github.com/cloudflare/cloudflared +LICENSE = Apache-2.0 +CHANGELOG = "Initial package release." + +WIZARDS_DIR = src/wizard/ + +STARTABLE = yes +SERVICE_USER = auto +SERVICE_SETUP = src/service-setup.sh + +include ../../mk/spksrc.spk.mk diff --git a/spk/cloudflared/src/cloudflared.png b/spk/cloudflared/src/cloudflared.png new file mode 100644 index 00000000000..dd5d5aea54d Binary files /dev/null and b/spk/cloudflared/src/cloudflared.png differ diff --git a/spk/cloudflared/src/service-setup.sh b/spk/cloudflared/src/service-setup.sh new file mode 100644 index 00000000000..2071cd9cecc --- /dev/null +++ b/spk/cloudflared/src/service-setup.sh @@ -0,0 +1,18 @@ +TOKEN_FILE="${SYNOPKG_PKGVAR}/token" + +# Read token from file +if [ -e $TOKEN_FILE ]; then + CLOUDFLARED_TOKEN="$(cat $TOKEN_FILE)" +fi + +SERVICE_COMMAND="${SYNOPKG_PKGDEST}/bin/cloudflared --no-autoupdate tunnel run --token ${CLOUDFLARED_TOKEN}" +SVC_BACKGROUND=y +SVC_WRITE_PID=y + +service_postinst () +{ + # Save token to file + if [ -n "${wizard_cloudflared_token}" ]; then + echo "${wizard_cloudflared_token}" >> ${TOKEN_FILE} + fi +} diff --git a/spk/cloudflared/src/wizard/install_uifile b/spk/cloudflared/src/wizard/install_uifile new file mode 100644 index 00000000000..5003416ee10 --- /dev/null +++ b/spk/cloudflared/src/wizard/install_uifile @@ -0,0 +1,20 @@ +[ + { + "step_title": "Tunnel configuration", + "items": [ + { + "type": "textfield", + "desc": "Token for the cloudflare tunnel", + "subitems": [ + { + "key": "wizard_cloudflared_token", + "desc": "Tunnel token", + "validator": { + "allowBlank": false + } + } + ] + } + ] + } +]