release/dist/qnap: add qnap target builder
Creates new QNAP builder target, which builds go binaries then uses docker to build into QNAP packages. Much of the docker/script code here is pulled over from https://github.com/tailscale/tailscale-qpkg, with adaptation into our builder structures. The qnap/Tailscale folder contains static resources needed to build Tailscale qpkg packages, and is an exact copy of the existing folder in the tailscale-qpkg repo. Builds can be run with: ``` sudo ./tool/go run ./cmd/dist build qnap ``` Updates tailscale/tailscale-qpkg#135 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
committed by
Sonia Appasamy
parent
b743b85dad
commit
0a84215036
+1
@@ -0,0 +1 @@
|
||||
,/Tailscale.sh,
|
||||
|
BIN
Binary file not shown.
|
After Width: | Height: | Size: 600 B |
Binary file not shown.
|
After Width: | Height: | Size: 741 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
+143
@@ -0,0 +1,143 @@
|
||||
######################################################################
|
||||
# List of available definitions (it's not necessary to uncomment them)
|
||||
######################################################################
|
||||
###### Command definitions #####
|
||||
#CMD_AWK="/bin/awk"
|
||||
#CMD_CAT="/bin/cat"
|
||||
#CMD_CHMOD="/bin/chmod"
|
||||
#CMD_CHOWN="/bin/chown"
|
||||
#CMD_CP="/bin/cp"
|
||||
#CMD_CUT="/bin/cut"
|
||||
#CMD_DATE="/bin/date"
|
||||
#CMD_ECHO="/bin/echo"
|
||||
#CMD_EXPR="/usr/bin/expr"
|
||||
#CMD_FIND="/usr/bin/find"
|
||||
#CMD_GETCFG="/sbin/getcfg"
|
||||
#CMD_GREP="/bin/grep"
|
||||
#CMD_GZIP="/bin/gzip"
|
||||
#CMD_HOSTNAME="/bin/hostname"
|
||||
#CMD_LN="/bin/ln"
|
||||
#CMD_LOG_TOOL="/sbin/log_tool"
|
||||
#CMD_MD5SUM="/bin/md5sum"
|
||||
#CMD_MKDIR="/bin/mkdir"
|
||||
#CMD_MV="/bin/mv"
|
||||
#CMD_RM="/bin/rm"
|
||||
#CMD_RMDIR="/bin/rmdir"
|
||||
#CMD_SED="/bin/sed"
|
||||
#CMD_SETCFG="/sbin/setcfg"
|
||||
#CMD_SLEEP="/bin/sleep"
|
||||
#CMD_SORT="/usr/bin/sort"
|
||||
#CMD_SYNC="/bin/sync"
|
||||
#CMD_TAR="/bin/tar"
|
||||
#CMD_TOUCH="/bin/touch"
|
||||
#CMD_WGET="/usr/bin/wget"
|
||||
#CMD_WLOG="/sbin/write_log"
|
||||
#CMD_XARGS="/usr/bin/xargs"
|
||||
#CMD_7Z="/usr/local/sbin/7z"
|
||||
#
|
||||
###### System definitions #####
|
||||
#SYS_EXTRACT_DIR="$(pwd)"
|
||||
#SYS_CONFIG_DIR="/etc/config"
|
||||
#SYS_INIT_DIR="/etc/init.d"
|
||||
#SYS_STARTUP_DIR="/etc/rcS.d"
|
||||
#SYS_SHUTDOWN_DIR="/etc/rcK.d"
|
||||
#SYS_RSS_IMG_DIR="/home/httpd/RSS/images"
|
||||
#SYS_QPKG_DATA_FILE_GZIP="./data.tar.gz"
|
||||
#SYS_QPKG_DATA_FILE_BZIP2="./data.tar.bz2"
|
||||
#SYS_QPKG_DATA_FILE_7ZIP="./data.tar.7z"
|
||||
#SYS_QPKG_DATA_CONFIG_FILE="./conf.tar.gz"
|
||||
#SYS_QPKG_DATA_MD5SUM_FILE="./md5sum"
|
||||
#SYS_QPKG_DATA_PACKAGES_FILE="./Packages.gz"
|
||||
#SYS_QPKG_CONFIG_FILE="$SYS_CONFIG_DIR/qpkg.conf"
|
||||
#SYS_QPKG_CONF_FIELD_QPKGFILE="QPKG_File"
|
||||
#SYS_QPKG_CONF_FIELD_NAME="Name"
|
||||
#SYS_QPKG_CONF_FIELD_VERSION="Version"
|
||||
#SYS_QPKG_CONF_FIELD_ENABLE="Enable"
|
||||
#SYS_QPKG_CONF_FIELD_DATE="Date"
|
||||
#SYS_QPKG_CONF_FIELD_SHELL="Shell"
|
||||
#SYS_QPKG_CONF_FIELD_INSTALL_PATH="Install_Path"
|
||||
#SYS_QPKG_CONF_FIELD_CONFIG_PATH="Config_Path"
|
||||
#SYS_QPKG_CONF_FIELD_WEBUI="WebUI"
|
||||
#SYS_QPKG_CONF_FIELD_WEBPORT="Web_Port"
|
||||
#SYS_QPKG_CONF_FIELD_SERVICEPORT="Service_Port"
|
||||
#SYS_QPKG_CONF_FIELD_SERVICE_PIDFILE="Pid_File"
|
||||
#SYS_QPKG_CONF_FIELD_AUTHOR="Author"
|
||||
#SYS_QPKG_CONF_FIELD_RC_NUMBER="RC_Number"
|
||||
## The following variables are assigned values at run-time.
|
||||
#SYS_HOSTNAME=$($CMD_HOSTNAME)
|
||||
## Data file name (one of SYS_QPKG_DATA_FILE_GZIP, SYS_QPKG_DATA_FILE_BZIP2,
|
||||
## or SYS_QPKG_DATA_FILE_7ZIP)
|
||||
#SYS_QPKG_DATA_FILE=
|
||||
## Base location.
|
||||
#SYS_QPKG_BASE=""
|
||||
## Base location of QPKG installed packages.
|
||||
#SYS_QPKG_INSTALL_PATH=""
|
||||
## Location of installed software.
|
||||
#SYS_QPKG_DIR=""
|
||||
## If the QPKG should be enabled or disabled after the installation/upgrade.
|
||||
#SYS_QPKG_SERVICE_ENABLED=""
|
||||
## Architecture of the device the QPKG is installed on.
|
||||
#SYS_CPU_ARCH=""
|
||||
## Name and location of system shares
|
||||
#SYS_PUBLIC_SHARE=""
|
||||
#SYS_PUBLIC_PATH=""
|
||||
#SYS_DOWNLOAD_SHARE=""
|
||||
#SYS_DOWNLOAD_PATH=""
|
||||
#SYS_MULTIMEDIA_SHARE=""
|
||||
#SYS_MULTIMEDIA_PATH=""
|
||||
#SYS_RECORDINGS_SHARE=""
|
||||
#SYS_RECORDINGS_PATH=""
|
||||
#SYS_USB_SHARE=""
|
||||
#SYS_USB_PATH=""
|
||||
#SYS_WEB_SHARE=""
|
||||
#SYS_WEB_PATH=""
|
||||
## Path to ipkg or opkg package tool if installed.
|
||||
#CMD_PKG_TOOL=
|
||||
#
|
||||
######################################################################
|
||||
# All package specific functions shall call 'err_log MSG' if an error
|
||||
# is detected that shall terminate the installation.
|
||||
######################################################################
|
||||
#
|
||||
######################################################################
|
||||
# Define any package specific operations that shall be performed when
|
||||
# the package is removed.
|
||||
######################################################################
|
||||
#PKG_PRE_REMOVE="{
|
||||
#}"
|
||||
#
|
||||
#PKG_MAIN_REMOVE="{
|
||||
#}"
|
||||
#
|
||||
PKG_POST_REMOVE="{
|
||||
rm -f /home/httpd/cgi-bin/qpkg/Tailscale
|
||||
rm -rf /tmp/tailscale
|
||||
if [ -f /etc/resolv.pre-tailscale-backup.conf ] && grep -q 100.100.100.100 /etc/resolv.conf; then
|
||||
mv /etc/resolv.pre-tailscale-backup.conf /etc/resolv.conf
|
||||
fi
|
||||
}"
|
||||
#
|
||||
######################################################################
|
||||
# Define any package specific initialization that shall be performed
|
||||
# before the package is installed.
|
||||
######################################################################
|
||||
#pkg_init(){
|
||||
#}
|
||||
#
|
||||
######################################################################
|
||||
# Define any package specific requirement checks that shall be
|
||||
# performed before the package is installed.
|
||||
######################################################################
|
||||
#pkg_check_requirement(){
|
||||
#}
|
||||
#
|
||||
######################################################################
|
||||
# Define any package specific operations that shall be performed when
|
||||
# the package is installed.
|
||||
######################################################################
|
||||
pkg_install(){
|
||||
${CMD_MKDIR} -p ${SYS_QPKG_DIR}/state
|
||||
}
|
||||
|
||||
#pkg_post_install(){
|
||||
#}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
# Name of the packaged application.
|
||||
QPKG_NAME="Tailscale"
|
||||
# Name of the display application.
|
||||
#QPKG_DISPLAY_NAME=""
|
||||
# Version of the packaged application.
|
||||
QPKG_VER="$QPKG_VER"
|
||||
# Author or maintainer of the package
|
||||
QPKG_AUTHOR="Tailscale Inc."
|
||||
# License for the packaged application
|
||||
#QPKG_LICENSE=""
|
||||
# One-line description of the packaged application
|
||||
#QPKG_SUMMARY="Connect all your devices using WireGuard, without the hassle."
|
||||
|
||||
# Preferred number in start/stop sequence.
|
||||
QPKG_RC_NUM="101"
|
||||
# Init-script used to control the start and stop of the installed application.
|
||||
QPKG_SERVICE_PROGRAM="Tailscale.sh"
|
||||
|
||||
# Optional 1 is enable. Path of starting/ stopping shall script. (no start/stop on App Center)
|
||||
#QPKG_DISABLE_APPCENTER_UI_SERVICE=1
|
||||
|
||||
# Specifies any packages required for the current package to operate.
|
||||
QPKG_REQUIRE=""
|
||||
# Specifies what packages cannot be installed if the current package
|
||||
# is to operate properly.
|
||||
#QPKG_CONFLICT="Python"
|
||||
# Name of configuration file (multiple definitions are allowed).
|
||||
#QPKG_CONFIG="Tailscale.cfg"
|
||||
#QPKG_CONFIG="/etc/config/myApp.conf"
|
||||
# Port number used by service program.
|
||||
QPKG_SERVICE_PORT="41641"
|
||||
# Location of file with running service's PID
|
||||
#QPKG_SERVICE_PIDFILE=""
|
||||
# Relative path to web interface
|
||||
QPKG_WEBUI="/cgi-bin/qpkg/Tailscale/index.cgi"
|
||||
# Port number for the web interface.
|
||||
#QPKG_WEB_PORT=""
|
||||
# Port number for the SSL web interface.
|
||||
#QPKG_WEB_SSL_PORT=""
|
||||
|
||||
# Use QTS HTTP Proxy and set Proxy_Path in the qpkg.conf.
|
||||
# When the QPKG has its own HTTP service port, and want clients to connect via QTS HTTP port (default 8080).
|
||||
# Usually use this option when the QPKG need to connect via myQNAPcloud service.
|
||||
QPKG_USE_PROXY="1"
|
||||
#QPKG_PROXY_PATH="/qpkg_name"
|
||||
|
||||
#Desktop Application (since 4.1)
|
||||
# Set value to 1 means to open the QPKG's Web UI inside QTS desktop instead of new window.
|
||||
#QPKG_DESKTOP_APP="1"
|
||||
# Desktop Application Window default inner width (since 4.1) (not over 1178)
|
||||
#QPKG_DESKTOP_APP_WIN_WIDTH=""
|
||||
# Desktop Application Window default inner height (since 4.1) (not over 600)
|
||||
#QPKG_DESKTOP_APP_WIN_HEIGHT=""
|
||||
|
||||
# Minimum QTS version requirement
|
||||
QTS_MINI_VERSION="5.0.0"
|
||||
# Maximum QTS version requirement
|
||||
#QTS_MAX_VERSION="5.0.0"
|
||||
|
||||
# Select volume
|
||||
# 1: support installation
|
||||
# 2: support migration
|
||||
# 3 (1+2): support both installation and migration
|
||||
QPKG_VOLUME_SELECT="1"
|
||||
|
||||
# Set timeout for QPKG enable and QPKG disable (since 4.1.0)
|
||||
# Format in seconds (enable, disable)
|
||||
#QPKG_TIMEOUT="10,30"
|
||||
|
||||
# Visible setting for the QPKG that has web UI, show this QPKG on the Main menu of
|
||||
# 1(default): administrators, 2: all NAS users.
|
||||
QPKG_VISIBLE="1"
|
||||
|
||||
# Location of icons for the packaged application.
|
||||
QDK_DATA_DIR_ICONS="icons"
|
||||
# Location of files specific to arm-x19 packages.
|
||||
#QDK_DATA_DIR_X19="arm-x19"
|
||||
# Location of files specific to arm-x31 packages.
|
||||
#QDK_DATA_DIR_X31="arm-x31"
|
||||
# Location of files specific to arm-x41 packages.
|
||||
#QDK_DATA_DIR_X41="arm_al"
|
||||
# Location of files specific to x86 packages.
|
||||
#QDK_DATA_DIR_X86="x86"
|
||||
# Location of files specific to x86 (64-bit) packages.
|
||||
#QDK_DATA_DIR_X86_64="x86_64"
|
||||
# Location of files common to all architectures.
|
||||
QDK_DATA_DIR_SHARED="shared"
|
||||
# Location of configuration files.
|
||||
#QDK_DATA_DIR_CONFIG="config"
|
||||
# Name of local data package.
|
||||
#QDK_DATA_FILE=""
|
||||
# Name of extra package (multiple definitions are allowed).
|
||||
#QDK_EXTRA_FILE=""
|
||||
# For QNAP code signing (currently can be done only inside QNAP)
|
||||
# Uncomment the following four options if you want to enable code signing for this QPKG
|
||||
#QNAP_CODE_SIGNING="0"
|
||||
#QNAP_CODE_SIGNING_SERVER_IP="codesigning.qnap.com.tw"
|
||||
#QNAP_CODE_SIGNING_SERVER_PORT="5001"
|
||||
#QNAP_CODE_SIGNING_CSV="build_sign.csv"
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
CONF=/etc/config/qpkg.conf
|
||||
QPKG_NAME="Tailscale"
|
||||
QPKG_ROOT=`/sbin/getcfg ${QPKG_NAME} Install_Path -f ${CONF}`
|
||||
QPKG_PORT=`/sbin/getcfg ${QPKG_NAME} Service_Port -f ${CONF}`
|
||||
export QNAP_QPKG=${QPKG_NAME}
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
ENABLED=$(/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f ${CONF})
|
||||
if [ "${ENABLED}" != "TRUE" ]; then
|
||||
echo "${QPKG_NAME} is disabled."
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p /home/httpd/cgi-bin/qpkg
|
||||
ln -sf ${QPKG_ROOT}/ui /home/httpd/cgi-bin/qpkg/${QPKG_NAME}
|
||||
mkdir -p -m 0755 /tmp/tailscale
|
||||
if [ -e /tmp/tailscale/tailscaled.pid ]; then
|
||||
PID=$(cat /tmp/tailscale/tailscaled.pid)
|
||||
if [ -d /proc/${PID}/ ]; then
|
||||
echo "${QPKG_NAME} is already running."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
${QPKG_ROOT}/tailscaled --port ${QPKG_PORT} --statedir=${QPKG_ROOT}/state --socket=/tmp/tailscale/tailscaled.sock 2> /dev/null &
|
||||
echo $! > /tmp/tailscale/tailscaled.pid
|
||||
;;
|
||||
|
||||
stop)
|
||||
if [ -e /tmp/tailscale/tailscaled.pid ]; then
|
||||
PID=$(cat /tmp/tailscale/tailscaled.pid)
|
||||
kill -9 ${PID} || true
|
||||
rm -f /tmp/tailscale/tailscaled.pid
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
remove)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|remove}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,2 @@
|
||||
Options +ExecCGI
|
||||
AddHandler cgi-script .cgi
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
CONF=/etc/config/qpkg.conf
|
||||
QPKG_NAME="Tailscale"
|
||||
QPKG_ROOT=$(/sbin/getcfg ${QPKG_NAME} Install_Path -f ${CONF} -d"")
|
||||
exec "${QPKG_ROOT}/tailscale" --socket=/tmp/tailscale/tailscaled.sock web --cgi --prefix="/cgi-bin/qpkg/Tailscale/index.cgi/"
|
||||
Reference in New Issue
Block a user