-
Notifications
You must be signed in to change notification settings - Fork 738
/
new_bn.sh
executable file
·77 lines (70 loc) · 2.24 KB
/
new_bn.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
#!/usr/bin/env bash
# Is necessary test the patches
set -e
declare -A KVERS
KVERS["DS918+"]="4.4.180"
KVERS["DS920+"]="4.4.180"
KVERS["DS923+"]="4.4.180"
KVERS["DS1520+"]="4.4.180"
KVERS["DS1621+"]="4.4.180"
KVERS["DS2422+"]="4.4.180"
KVERS["DS3615xs"]="3.10.108"
KVERS["DS3617xs"]="4.4.180"
KVERS["DS3622xs+"]="4.4.180"
KVERS["DVA1622"]="4.4.180"
KVERS["DVA3219"]="4.4.180"
KVERS["DVA3221"]="4.4.180"
KVERS["FS2500"]="4.4.180"
KVERS["RS4021xs+"]="4.4.180"
RELEASE="7.1.1"
BUILDNUMBER="42962"
EXTRA=""
for MODEL in DS918+ DS920+ DS923+ DS1520+ DS1621+ DS2422+ DS3615xs DS3617xs DS3622xs+ DVA1622 DVA3221 DVA3219 FS2500 RS4021xs+; do
MODEL_CODED=`echo ${MODEL} | sed 's/+/%2B/g'`
URL="https://global.download.synology.com/download/DSM/release/${RELEASE}/${BUILDNUMBER}${EXTRA}/DSM_${MODEL_CODED}_${BUILDNUMBER}.pat"
#URL="https://archive.synology.com/download/Os/DSM/${RELEASE}-${BUILDNUMBER}/DSM_${MODEL_CODED}_${BUILDNUMBER}.pat"
FILENAME="${MODEL}-${BUILDNUMBER}.pat"
FILEPATH="/tmp/${FILENAME}"
echo -n "Checking ${MODEL}... "
if [ -f ${FILEPATH} ]; then
echo "cached"
else
echo "no cached, downloading..."
fi
STATUS=`curl --progress-bar -o ${FILEPATH} -w "%{http_code}" -L "${URL}"`
if [ ${STATUS} -ne 200 ]; then
echo "error: HTTP status = ${STATUS}"
rm -f ${FILEPATH}
continue
fi
echo "Calculating md5:"
PAT_MD5=`md5sum ${FILEPATH} | awk '{print$1}'`
echo "Calculating sha256:"
sudo rm -rf /tmp/extracted
docker run --rm -it -v /tmp:/data syno-extractor /data/${FILENAME} /data/extracted
PAT_CS=`sha256sum ${FILEPATH} | awk '{print$1}'`
ZIMAGE_CS=`sha256sum /tmp/extracted/zImage | awk '{print$1}'`
RD_CS=`sha256sum /tmp/extracted/rd.gz | awk '{print$1}'`
sudo rm -rf /tmp/extracted
cat <<EOF
${BUILDNUMBER}:
ver: "${RELEASE}"
kver: "${KVERS[${MODEL}]}"
rd-compressed: false
cmdline:
<<: *cmdline
synoinfo:
<<: *synoinfo
pat:
url: "${URL}"
hash: "${PAT_CS}"
ramdisk-hash: "${RD_CS}"
zimage-hash: "${ZIMAGE_CS}"
md5-hash: "${PAT_MD5}"
patch:
- "ramdisk-common-disable-root-pwd.patch"
- "ramdisk-common-init-script.patch"
- "ramdisk-42951-post-init-script.patch"
- "ramdisk-42661-disable-disabled-ports.patch"
EOF
done