From f5ab42fd3fb62d58587868c76c0264db882a2042 Mon Sep 17 00:00:00 2001 From: Wes Malone Date: Wed, 7 Aug 2024 10:04:48 -0500 Subject: [PATCH] Add all arch --- all/Dockerfile | 32 ++++++++++++++++++++++++++++++++ all/README.md | 18 ++++++++++++++++++ all/app/LICENSE | 29 +++++++++++++++++++++++++++++ all/app/Makefile | 1 + all/app/Tailscale_VPN | 10 ++++++++++ all/app/html/index.html | 19 +++++++++++++++++++ all/app/manifest.json | 18 ++++++++++++++++++ 7 files changed, 127 insertions(+) create mode 100644 all/Dockerfile create mode 100644 all/README.md create mode 100644 all/app/LICENSE create mode 100644 all/app/Makefile create mode 100755 all/app/Tailscale_VPN create mode 100644 all/app/html/index.html create mode 100644 all/app/manifest.json diff --git a/all/Dockerfile b/all/Dockerfile new file mode 100644 index 0000000..1222c0b --- /dev/null +++ b/all/Dockerfile @@ -0,0 +1,32 @@ +# example usage: +# docker build --build-arg ARCH=armv7hf --build-arg TAILSCALE_VERSION=1.70.0 -t axis_tailscale:latest . +# docker cp $(docker create axis_tailscale):/opt/app ./build + +ARG REPO=axisecp +ARG SDK=acap-native-sdk +ARG VERSION=1.3 +ARG ARCH=armv7hf +ARG UBUNTU_VERSION=22.04 + +FROM ${REPO}/${SDK}:${VERSION}-${ARCH}-ubuntu${UBUNTU_VERSION} +WORKDIR /opt/app +COPY ./app /opt/app/ + +ARG ARCH=armv7hf +ARG TAILSCALE_VERSION=1.68.1 + +# template files +RUN sed -i "s/@@ARCH@@/${ARCH}/g" /opt/app/manifest.json \ + && sed -i "s/@@TAILSCALE_VERSION@@/${TAILSCALE_VERSION}/g" /opt/app/manifest.json + +# tailscale uses "arm(64)" instead of the more specific arm arch names +RUN \ + if [ "${ARCH}" = "armv7hf" ]; then TAILSCALE_ARCH="arm"; \ + elif [ "${ARCH}" = "aarch64" ]; then TAILSCALE_ARCH="arm64"; \ + else TAILSCALE_ARCH="${ARCH}"; fi \ + && curl -sS --fail -L -o /tmp/tailscale.tgz https://pkgs.tailscale.com/stable/tailscale_${TAILSCALE_VERSION}_${TAILSCALE_ARCH}.tgz \ + && mkdir -p /opt/app/lib \ + && tar xzf /tmp/tailscale.tgz -C /opt/app/lib --strip-components=1 --wildcards --no-anchored '*/tailscale' '*/tailscaled' \ + && rm /tmp/tailscale.tgz + +RUN . /opt/axis/acapsdk/environment-setup* && acap-build ./ diff --git a/all/README.md b/all/README.md new file mode 100644 index 0000000..248b54b --- /dev/null +++ b/all/README.md @@ -0,0 +1,18 @@ +# Building + +Set your preferred build parameters via the docker build command. + +* `ARCH` - use the Axis architecture string you can fetch from `/axis-cgi/param.cgi?action=list&group=Properties.System.Architecture` +* `TAILSCALE_VERSION` - Specify the version string as it appears on the [Tailscale archive](https://pkgs.tailscale.com/stable/#static) + +Tailscale arm arch strings are different than the axis format. The Dockerfile has some mappings for common strings. + +``` +docker build --build-arg ARCH=armv7hf --build-arg TAILSCALE_VERSION=1.70.0 -t axis_tailscale:latest . +``` + +Then copy out the build artifacts: + +``` +docker cp $(docker create axis_tailscale):/opt/app ./build +``` diff --git a/all/app/LICENSE b/all/app/LICENSE new file mode 100644 index 0000000..9241b06 --- /dev/null +++ b/all/app/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2020 Tailscale & AUTHORS. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/all/app/Makefile b/all/app/Makefile new file mode 100644 index 0000000..74caba9 --- /dev/null +++ b/all/app/Makefile @@ -0,0 +1 @@ +nop: \ No newline at end of file diff --git a/all/app/Tailscale_VPN b/all/app/Tailscale_VPN new file mode 100755 index 0000000..85478e1 --- /dev/null +++ b/all/app/Tailscale_VPN @@ -0,0 +1,10 @@ +#!/bin/sh + + echo "Starting Service" + chmod 777 /usr/local/packages/Tailscale_VPN/lib/tailscale + chmod 777 /usr/local/packages/Tailscale_VPN/lib/tailscaled + /usr/local/packages/Tailscale_VPN/lib/tailscaled --tun=userspace-networking --socket=/usr/local/packages/Tailscale_VPN/tailscaled.sock & + echo "Service Started" + echo "Scroll to Bottom for link" + /usr/local/packages/Tailscale_VPN/lib/tailscale --socket=/usr/local/packages/Tailscale_VPN/tailscaled.sock up + wait diff --git a/all/app/html/index.html b/all/app/html/index.html new file mode 100644 index 0000000..59f2be7 --- /dev/null +++ b/all/app/html/index.html @@ -0,0 +1,19 @@ + + + + +

Scroll to the bottom to find authentication URL

+ + + + + + + + diff --git a/all/app/manifest.json b/all/app/manifest.json new file mode 100644 index 0000000..e34d43b --- /dev/null +++ b/all/app/manifest.json @@ -0,0 +1,18 @@ +{ + "schemaVersion": "1.3", + "acapPackageConf": { + "setup": { + "appName": "Tailscale_VPN", + "friendlyName": "Tailscale VPN", + "vendor": "Tailscale - Packaged by Mo3he", + "embeddedSdkVersion": "3.0", + "vendorUrl": "https://www.tailscale.com", + "runMode": "once", + "version": "@@TAILSCALE_VERSION@@", + "architecture": "@@ARCH@@" + }, + "configuration": { + "settingPage": "index.html" + } + } +}