mirror of
https://github.com/AuxXxilium/synology-wireguard.git
synced 2024-11-23 23:11:06 +07:00
get package versions at runtime, leverage Docker volumes to improve file cache reuse to speed up runtime
This commit is contained in:
parent
1ab0d9c701
commit
85a284523a
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
artifacts/
|
@ -1,4 +1,6 @@
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:latest
|
||||
|
||||
VOLUME [ "/toolkit_tarballs" ]
|
||||
|
||||
ENV IS_IN_CONTAINER 1
|
||||
|
||||
|
2
INFO.sh
2
INFO.sh
@ -2,7 +2,7 @@
|
||||
source /pkgscripts-ng/include/pkg_util.sh
|
||||
|
||||
package="WireGuard"
|
||||
version="1.0.20200401"
|
||||
version="$WIREGUARD_VERSION"
|
||||
displayname="WireGuard"
|
||||
maintainer="Andreas Runfalk"
|
||||
arch="$(pkg_get_platform)"
|
||||
|
3
Makefile
3
Makefile
@ -1,6 +1,3 @@
|
||||
WIREGUARD_VERSION ?= 1.0.20200401
|
||||
WIREGUARD_TOOLS_VERSION ?= 1.0.20200319
|
||||
LIBMNL_VERSION ?= 1.0.4
|
||||
HAS_MEMNEQ ?= 0
|
||||
|
||||
LIBMNL_TAR := libmnl-$(LIBMNL_VERSION).tar.bz2
|
||||
|
15
README.rst
15
README.rst
@ -168,6 +168,21 @@ If everything worked you should have a directory called ``artifacts`` that
|
||||
contains your SPK files.
|
||||
|
||||
|
||||
Avoiding timeouts when downloading build files
|
||||
----------------------------------------------
|
||||
It can take a long time to pull development files from SourceForge, including
|
||||
occasional timeouts. To get around this, create a folder locally and map it to
|
||||
the `/toolkit_tarballs` Docker volume using the following command:
|
||||
`-v $(pwd)/<path/to/folder>:/toolkit_tarballs`
|
||||
to the `docker run` command listed above. This will allow the development files
|
||||
to be stored on your host machine instead of ephemerally in the container. The
|
||||
image will check for existing development files in that folder and will use
|
||||
them instead of pulling them from SourceForge when possible. You can also
|
||||
download the files directly and put them in the folder you created by downloading
|
||||
them from here: https://sourceforge.net/projects/dsgpl/files/toolkit/DSM<DSM_VER>
|
||||
(e.g. https://sourceforge.net/projects/dsgpl/files/toolkit/DSM6.2)
|
||||
|
||||
|
||||
Credits
|
||||
-------
|
||||
I based a lot of this work on
|
||||
|
20
build.sh
20
build.sh
@ -15,6 +15,10 @@ if [ -z ${DSM_VER+x} ]; then
|
||||
exit 3
|
||||
fi
|
||||
|
||||
export WIREGUARD_VERSION=$(wget -q https://git.zx2c4.com/wireguard-linux-compat/refs/ -O - | grep -oP '\/wireguard-linux-compat\/tag\/\?h=v\K[.0-9]*' | head -n 1)
|
||||
export WIREGUARD_TOOLS_VERSION=$(wget -q https://git.zx2c4.com/wireguard-tools/refs/ -O - | grep -oP '\/wireguard-tools\/tag\/\?h=v\K[.0-9]*' | head -n 1)
|
||||
export LIBMNL_VERSION=$(wget -q 'https://netfilter.org/projects/libmnl/files/?C=M;O=D' -O - | grep -oP 'a href="libmnl-\K[0-9.]*' | head -n 1 | sed 's/.\{1\}$//')
|
||||
|
||||
# Ensure that we are working directly in the root file system. Though this
|
||||
# should always be the case in containers.
|
||||
cd /
|
||||
@ -23,14 +27,24 @@ cd /
|
||||
set -e
|
||||
|
||||
# Fetch Synology toolchain
|
||||
if [ ! -d /pkgscripts-ng ]; then
|
||||
if [[ ! -d /pkgscripts-ng ]] || [ -z "$(ls -A /pkgscripts-ng)" ]; then
|
||||
git clone https://github.com/SynologyOpenSource/pkgscripts-ng
|
||||
else
|
||||
echo "Existing pkgscripts-ng repo found. Pulling latest from origin."
|
||||
cd /pkgscripts-ng
|
||||
git pull origin
|
||||
cd /
|
||||
fi
|
||||
|
||||
# Install the toolchain for the given package arch and DSM version
|
||||
build_env="/build_env/ds.$PACKAGE_ARCH-$DSM_VER"
|
||||
|
||||
if [ ! -d "$build_env" ]; then
|
||||
pkgscripts-ng/EnvDeploy -p $PACKAGE_ARCH -v $DSM_VER
|
||||
if [ -f "/toolkit_tarballs/base_env-$DSM_VER.txz" ] && [ -f "/toolkit_tarballs/ds.$PACKAGE_ARCH-$DSM_VER.env.txz" ] && [ -f "/toolkit_tarballs/ds.$PACKAGE_ARCH-$DSM_VER.dev.txz" ]; then
|
||||
pkgscripts-ng/EnvDeploy -p $PACKAGE_ARCH -v $DSM_VER -t /toolkit_tarballs
|
||||
else
|
||||
pkgscripts-ng/EnvDeploy -p $PACKAGE_ARCH -v $DSM_VER
|
||||
fi
|
||||
|
||||
# Ensure the installed toolchain has support for CA signed certificates.
|
||||
# Without this wget on https:// will fail
|
||||
@ -41,7 +55,7 @@ fi
|
||||
set +e
|
||||
|
||||
# By default we patch WireGuard to always use include its own memneq
|
||||
# implemenation. This is required on most NASes, but some of them come with
|
||||
# implementation. This is required on most NASes, but some of them come with
|
||||
# built in memneq support. Unless HAS_MEMNEQ is defined we set it for models
|
||||
# that support it here.
|
||||
if [ -z ${HAS_MEMNEQ+x} ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user