2020-08-15 22:02:29 +07:00
|
|
|
#!/bin/bash
|
2023-05-15 00:32:45 +07:00
|
|
|
VERSIONS=(6.2 7.0 7.1 7.2)
|
2020-08-15 22:02:29 +07:00
|
|
|
ARCHS=(
|
2021-01-21 07:45:49 +07:00
|
|
|
"apollolake"
|
2020-08-15 22:02:29 +07:00
|
|
|
"armada38x"
|
|
|
|
"avoton"
|
|
|
|
"braswell"
|
|
|
|
"broadwell"
|
2020-12-30 21:39:47 +07:00
|
|
|
"broadwellnk"
|
|
|
|
"bromolow"
|
2020-08-15 22:02:29 +07:00
|
|
|
"cedarview"
|
|
|
|
"denverton"
|
2020-12-30 21:39:47 +07:00
|
|
|
"geminilake"
|
|
|
|
"kvmx64"
|
|
|
|
"monaco"
|
2023-04-10 15:22:22 +07:00
|
|
|
"r1000"
|
2020-08-15 22:02:29 +07:00
|
|
|
"rtd1296"
|
2023-03-28 00:04:29 +07:00
|
|
|
"rtd1619b"
|
2021-01-21 07:45:49 +07:00
|
|
|
"x64"
|
2020-08-15 22:02:29 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Check that we are running as root
|
|
|
|
if [ `id -u` -ne 0 ]; then
|
|
|
|
echo "This script must be run as root"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Download all necessary tarballs before calling into the docker containers.
|
|
|
|
echo "Downloading environment tarballs"
|
2021-01-21 07:45:49 +07:00
|
|
|
for ver in ${VERSIONS[@]}; do
|
|
|
|
url_base="https://sourceforge.net/projects/dsgpl/files/toolkit/DSM$ver"
|
|
|
|
pushd toolkit_tarballs/
|
|
|
|
if [ ! -f base_env-$ver.txz ]; then
|
|
|
|
wget -q --show-progress "$url_base/base_env-$ver.txz"
|
2020-08-15 22:02:29 +07:00
|
|
|
fi
|
2021-01-21 07:45:49 +07:00
|
|
|
for arch in ${ARCHS[@]}; do
|
|
|
|
if [ ! -f ds.$arch-$ver.dev.txz ]; then
|
|
|
|
wget -q --show-progress "$url_base/ds.$arch-$ver.dev.txz"
|
|
|
|
fi
|
|
|
|
if [ ! -f ds.$arch-$ver.env.txz ]; then
|
|
|
|
wget -q --show-progress "$url_base/ds.$arch-$ver.env.txz"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
popd
|
2020-08-15 22:02:29 +07:00
|
|
|
done
|
|
|
|
|
|
|
|
# Ensure that we are using an up to date docker image
|
|
|
|
docker build -t synobuild .
|
|
|
|
|
2021-01-21 07:45:49 +07:00
|
|
|
for ver in ${VERSIONS[@]}; do
|
|
|
|
# Create release directory if needed
|
|
|
|
mkdir -p target/$ver
|
2020-08-15 22:02:29 +07:00
|
|
|
|
2021-01-21 07:45:49 +07:00
|
|
|
for arch in ${ARCHS[@]}; do
|
|
|
|
echo "Building '$arch'"
|
|
|
|
|
|
|
|
# Remove old artifact directory
|
|
|
|
if [ -d artifacts/ ]; then
|
|
|
|
rm -rf artifacts/
|
|
|
|
fi
|
2020-08-15 22:02:29 +07:00
|
|
|
|
2021-01-21 07:45:49 +07:00
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
--privileged \
|
|
|
|
--env PACKAGE_ARCH=$arch \
|
|
|
|
--env DSM_VER=$ver \
|
|
|
|
-v $(pwd)/artifacts:/result_spk \
|
|
|
|
-v $(pwd)/toolkit_tarballs:/toolkit_tarballs \
|
|
|
|
synobuild
|
2020-08-15 22:02:29 +07:00
|
|
|
|
2021-01-21 07:45:49 +07:00
|
|
|
mv artifacts/WireGuard-*/* target/$ver/
|
|
|
|
done
|
2020-08-15 22:02:29 +07:00
|
|
|
done
|
|
|
|
|
|
|
|
# Clean up artifact directory
|
|
|
|
if [ -d artifacts/ ]; then
|
|
|
|
rm -rf artifacts/
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Change permissions of the target directory to match the local user if called
|
|
|
|
# using sudo
|
|
|
|
if [ ! -z ${SUDO_USER+x} ]; then
|
|
|
|
chown "$SUDO_USER:$SUDO_USER" -R target/
|
|
|
|
fi
|