Skip to content

Commit

Permalink
Add cloudflared (#5333)
Browse files Browse the repository at this point in the history
* Add cloudflared

* Update icon filename
  • Loading branch information
karasevm authored Jul 3, 2022
1 parent cae6b06 commit f8ebb1e
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cross/cloudflared/Makefile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions cross/cloudflared/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin:bin/cloudflared
3 changes: 3 additions & 0 deletions cross/cloudflared/digests
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions spk/cloudflared/Makefile
Original file line number Diff line number Diff line change
@@ -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
Binary file added spk/cloudflared/src/cloudflared.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions spk/cloudflared/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -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
}
20 changes: 20 additions & 0 deletions spk/cloudflared/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
]
}
]

0 comments on commit f8ebb1e

Please sign in to comment.