diff --git a/docker/Dockerfile.template b/docker/Dockerfile.template index 2b48eee7..864660f7 100644 --- a/docker/Dockerfile.template +++ b/docker/Dockerfile.template @@ -11,7 +11,12 @@ RUN for V in ${PLATFORMS}; do \ mkdir "/opt/${PLATFORM}" && \ tar -xaf "/cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" -C "/opt/${PLATFORM}" --strip-components=10 \ "usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-7.0/build" && \ - echo -e "${PLATFORM}\t${KVER}" >> /opt/platforms; \ + echo -e "${PLATFORM}\t${KVER}" >> /opt/platforms && \ + if [ ! -d "/opt/linux-${KVER}" ]; then \ + mkdir "/opt/linux-${KVER}" && \ + echo "Extracting linux-${KVER}.tar.xz" && \ + tar -xaf "/cache/linux-${KVER}.tar.xz" -C "/opt/linux-${KVER}" --strip-components=1; \ + fi; \ done; \ done @@ -22,7 +27,7 @@ ENV SHELL=/bin/bash \ RUN apt update --yes && \ apt install --yes --no-install-recommends --no-install-suggests \ - build-essential nano make ncurses-dev && \ + build-essential nano make ncurses-dev bc libssl-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* diff --git a/docker/build.sh b/docker/build.sh index 995765b1..386def5d 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -20,6 +20,7 @@ done <../PLATFORMS mkdir -p cache TOOLKIT_VER="7.0" for PLATFORM in ${!PLATFORMS[@]}; do + KVER="${PLATFORMS[${PLATFORM}]}" echo -n "Checking cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz... " if [ ! -f "cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" ]; then URL="https://global.download.synology.com/download/ToolChain/toolkit/${TOOLKIT_VER}/${PLATFORM}/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" @@ -28,6 +29,14 @@ for PLATFORM in ${!PLATFORMS[@]}; do else echo "OK" fi + echo -n "Checking cache/linux-${KVER}.tar.xz... " + if [ ! -f "cache/linux-${KVER}.tar.xz" ]; then + URL="https://cdn.kernel.org/pub/linux/kernel/v${KVER:0:1}.x/linux-${KVER}.tar.xz" + echo "Downloading ${URL}" + curl -L "${URL}" -o "cache/linux-${KVER}.tar.xz" + else + echo "OK" + fi done # Generate Dockerfile