get package versions at runtime, leverage Docker volumes to improve file cache reuse to speed up runtime

This commit is contained in:
Raman Gupta 2020-07-04 16:20:26 -04:00 committed by Andreas Runfalk
parent 1ab0d9c701
commit 85a284523a
6 changed files with 37 additions and 8 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
artifacts/

View File

@ -1,4 +1,6 @@
FROM ubuntu:18.04
FROM ubuntu:latest
VOLUME [ "/toolkit_tarballs" ]
ENV IS_IN_CONTAINER 1

View File

@ -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)"

View File

@ -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

View File

@ -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

View File

@ -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