-
Notifications
You must be signed in to change notification settings - Fork 134
/
release.sh
executable file
·84 lines (73 loc) · 1.96 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
VERSIONS=(6.2 7.0)
ARCHS=(
"apollolake"
"armada38x"
"avoton"
"braswell"
"broadwell"
"broadwellnk"
"bromolow"
"cedarview"
"denverton"
"geminilake"
"kvmx64"
"monaco"
"rtd1296"
"x64"
)
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"
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"
fi
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
done
# Ensure that we are using an up to date docker image
docker build -t synobuild .
for ver in ${VERSIONS[@]}; do
# Create release directory if needed
mkdir -p target/$ver
for arch in ${ARCHS[@]}; do
echo "Building '$arch'"
# Remove old artifact directory
if [ -d artifacts/ ]; then
rm -rf artifacts/
fi
docker run \
--rm \
--privileged \
--env PACKAGE_ARCH=$arch \
--env DSM_VER=$ver \
-v $(pwd)/artifacts:/result_spk \
-v $(pwd)/toolkit_tarballs:/toolkit_tarballs \
synobuild
mv artifacts/WireGuard-*/* target/$ver/
done
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