Merge branch 'dev' of github.com:zerotier/ZeroTierOne into dev

This commit is contained in:
Adam Ierymenko 2022-04-27 14:12:10 -04:00
commit 760bba67e7
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3
27 changed files with 398 additions and 0 deletions

8
pkg/qnap/Dockerfile Normal file
View File

@ -0,0 +1,8 @@
# vim: ft=dockerfile
FROM ubuntu:20.04
# COPY zerotier/qbuild /qbuild
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

13
pkg/qnap/build.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
build_packages()
{
sudo docker run -v $(pwd):/zto ztqnap
}
build_container()
{
sudo docker build -t ztqnap . --load
}
"$@"

76
pkg/qnap/entrypoint.sh Executable file
View File

@ -0,0 +1,76 @@
#!/bin/bash
ZTO_VER=$(git describe --abbrev=0 --tags)
ZTO_COMMIT=$(git rev-parse HEAD)
ZTO_DESC=$(jq -r '.desc' ../config.json)
mkdir -p pkg/qnap/zerotier/arm_64
mkdir -p pkg/qnap/zerotier/arm_x09
mkdir -p pkg/qnap/zerotier/arm_x10
mkdir -p pkg/qnap/zerotier/arm_x12
mkdir -p pkg/qnap/zerotier/arm_x19
mkdir -p pkg/qnap/zerotier/arm_x31
mkdir -p pkg/qnap/zerotier/arm_x41
mkdir -p pkg/qnap/zerotier/x86_64
mkdir -p pkg/qnap/zerotier/x86
mkdir -p pkg/qnap/zerotier/x86_ce53xx
cat > pkg/qnap/zerotier/qpkg.cfg <<- EOM
# Update package config
# Name of the packaged application.
QPKG_NAME="zerotier"
# Name of the display application.
QPKG_DISPLAY_NAME="ZeroTier"
# Version of the packaged application.
QPKG_VER="$ZTO_VER"
# Author or maintainer of the package
QPKG_AUTHOR="ZeroTier, Inc."
# License for the packaged application
QPKG_LICENSE="BUSL-1.1"
# One-line description of the packaged application
QPKG_SUMMARY="$ZTO_DESC"
# 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="zerotier.sh"
# Specifies any packages required for the current package to operate.
QPKG_REQUIRE="QVPN Service"
# Specifies what packages cannot be installed if the current package
# is to operate properly.
#QPKG_CONFLICT="Python, OPT/sed"
# Name of configuration file (multiple definitions are allowed).
#QPKG_CONFIG="myApp.conf"
#QPKG_CONFIG="/etc/config/myApp.conf"
# Port number used by service program.
QPKG_SERVICE_PORT="9993"
# Minimum QTS version requirement
QTS_MINI_VERSION="4.1.0"
# Maximum QTS version requirement
QTS_MAX_VERSION="5.0.0"
# Location of icons for the packaged application.
QDK_DATA_DIR_ICONS="icons"
EOM
# Copy binaries into pkg directory
# See: https://github.com/qnap-dev/QDK
cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-aarch64 pkg/qnap/zerotier/arm_64/zerotier-one
#cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-armv5tejl pkg/qnap/zerotier/arm-x09/zerotier-one
#cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-armv5tel pkg/qnap/zerotier/arm-x19/zerotier-one
cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-armhf pkg/qnap/zerotier/arm-x31/zerotier-one
cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-armhf pkg/qnap/zerotier/arm-x41/zerotier-one
cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-i386 pkg/qnap/zerotier/x86/zerotier-one
cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-x86_64 pkg/qnap/zerotier/x86_64/zerotier-one
cp -vf output/static/zerotier-one.${ZTO_VER}.alpine-i386 pkg/qnap/zerotier/x86_ce53xx/zerotier-one
rm -rf output/qnap/*
pushd pkg/qnap/zerotier
./qbuild #--build-arch arm-x31
cp -f build/* ../../../output/qnap
# Show output product
cd popd

3
pkg/qnap/qdk.conf Normal file
View File

@ -0,0 +1,3 @@
QDK_VERSION=2.3.11
QDK_PATH_P=`pwd | awk 'BEGIN { FS = "QDK" } ; { print $1 }'`
QDK_PATH="${QDK_PATH_P}/QDK"

View File

@ -0,0 +1,7 @@
.PHONY: all
all:
@$(CC) -o qpkg_encrypt qpkg_encrypt.c
clean:
rm -rf /bin/qpkg_encrypt

View File

View File

View File

View File

View File

View File

View File

View File

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,158 @@
######################################################################
# 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="{
rm -rf /usr/sbin/zerotier-cli
# all identity files are stored in the Install_Path and will be removed automatically
}"
#PKG_POST_REMOVE="{
#}"
######################################################################
# Define any package specific initialization that shall be performed
# before the package is installed.
######################################################################
pkg_init()
{
modprobe tun
}
######################################################################
# 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_pre_install()
#{
# log "pkg_pre_install"
#}
#pkg_install()
#{
# log "pkg_install"
#}
pkg_post_install()
{
log $SYS_QPKG_INSTALL_PATH
modprobe tun
}

View File

@ -0,0 +1,99 @@
# Update package config
# Name of the packaged application.
QPKG_NAME="zerotier"
# Name of the display application.
QPKG_DISPLAY_NAME="ZeroTier"
# Version of the packaged application.
QPKG_VER="1.8.4"
# Author or maintainer of the package
QPKG_AUTHOR="ZeroTier, Inc."
# License for the packaged application
QPKG_LICENSE="BUSL-1.1"
# One-line description of the packaged application
QPKG_SUMMARY="Securely connect any device, anywhere."
# 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="zerotier.sh"
# Specifies any packages required for the current package to operate.
QPKG_REQUIRE="QVPN Service"
# Specifies what packages cannot be installed if the current package
# is to operate properly.
#QPKG_CONFLICT="Python, OPT/sed"
# Name of configuration file (multiple definitions are allowed).
#QPKG_CONFIG="myApp.conf"
#QPKG_CONFIG="/etc/config/myApp.conf"
# Port number used by service program.
QPKG_SERVICE_PORT="9993"
# Location of file with running service's PID
#QPKG_SERVICE_PIDFILE="/var/lib/zerotier-one/zerotier-one.pid"
# Relative path to web interface
#QPKG_WEBUI=""
# 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 width (since 4.1) (not over 600)
#QPKG_DESKTOP_APP_WIN_HEIGHT=""
# Minimum QTS version requirement
QTS_MINI_VERSION="4.1.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="0"
# 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="2"
# Location of the chroot environment (only TS-x09)
#QPKG_ROOTFS=""
# Init-script used to controls the start and stop of the
# installed application (only TS-x09)
#QPKG_SERVICE_PROGRAM_CHROOT=""
# Location of icons for the packaged application.
QDK_DATA_DIR_ICONS="icons"
# Location of files specific to arm-x09 packages.
#QDK_DATA_DIR_X09="arm-x09"
# 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=""

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,34 @@
#!/bin/sh
CONF=/etc/config/qpkg.conf
QPKG_NAME="zerotier"
QPKG_ROOT=`/sbin/getcfg $QPKG_NAME Install_Path -f ${CONF}`
APACHE_ROOT=/share/`/sbin/getcfg SHARE_DEF defWeb -d Qweb -f /etc/config/def_share.info`
case "$1" in
start)
modprobe tun
ln -s $QPKG_ROOT/zerotier-one /usr/sbin/zerotier-cli
ln -s $QPKG_ROOT/zerotier-one /usr/bin/zerotier-cli
ln -s $QPKG_ROOT /var/lib/zerotier-one
ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
if [ "$ENABLED" != "TRUE" ]; then
echo "$QPKG_NAME is disabled."
exit 1
fi
$QPKG_ROOT/zerotier-one $QPKG_ROOT -d
;;
stop)
killall zerotier-one
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0

View File

View File

View File