-
Notifications
You must be signed in to change notification settings - Fork 735
/
make_rsss.sh
executable file
·91 lines (81 loc) · 2.22 KB
/
make_rsss.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
85
86
87
88
89
90
91
#!/usr/bin/env bash
set -e
MODEL_CONFIG_PATH="./files/board/arpl/overlayfs/opt/arpl/model-configs"
RELEASE="7.0.1"
BUILDNUMBER="42218"
EXTRA=""
function readConfigKey() {
RESULT=`yq eval '.'${1}' | explode(.)' "${2}"`
[ "${RESULT}" == "null" ] && echo "" || echo ${RESULT}
}
function readModelKey() {
readConfigKey "${2}" "${MODEL_CONFIG_PATH}/${1}.yml"
}
# JSON
cat <<EOF
{
"title": "DSM ${RELEASE}-${BUILDNUMBER}",
"MajorVer": ${RELEASE:0:1},
"MinorVer": ${RELEASE:2:1},
"NanoVer": ${RELEASE:4:1},
"BuildPhase": 0,
"BuildNum": ${BUILDNUMBER},
"BuildDate": "2022/08/01",
"ReqMajorVer": 7,
"ReqMinorVer": 1,
"ReqBuildPhase": 0,
"ReqBuildNum": 41890,
"ReqBuildDate": "2021/06/25",
"isSecurityVersion": false,
"model": [
EOF
while read M; do
M="`basename ${M}`"
M="${M::-4}"
UNIQUE=`readModelKey "${M}" "unique"`
URL=`readModelKey "${M}" "builds.${BUILDNUMBER}.pat.url"`
HASH=`readModelKey "${M}" "builds.${BUILDNUMBER}.pat.md5-hash"`
cat <<EOF
{
"mUnique": "${UNIQUE}",
"mLink": "${URL}",
"mCheckSum": "${HASH}"
},
EOF
done < <(find "${MODEL_CONFIG_PATH}" -maxdepth 1 -name \*.yml | sort)
cat <<EOF
]
},
EOF
# XML
cat <<EOF
<item>
<title>DSM ${RELEASE}-${BUILDNUMBER}</title>
<MajorVer>${RELEASE:0:1}</MajorVer>
<MinorVer>${RELEASE:2:1}</MinorVer>
<BuildPhase>${RELEASE:4:1}</BuildPhase>
<BuildNum>${BUILDNUMBER}</BuildNum>
<BuildDate>2022/08/01</BuildDate>
<ReqMajorVer>7</ReqMajorVer>
<ReqMinorVer>0</ReqMinorVer>
<ReqBuildPhase>0</ReqBuildPhase>
<ReqBuildNum>41890</ReqBuildNum>
<ReqBuildDate>2021/06/25</ReqBuildDate>
EOF
while read M; do
M="`basename ${M}`"
M="${M::-4}"
UNIQUE=`readModelKey "${M}" "unique"`
URL=`readModelKey "${M}" "builds.${BUILDNUMBER}.pat.url"`
HASH=`readModelKey "${M}" "builds.${BUILDNUMBER}.pat.md5-hash"`
cat <<EOF
<model>
<mUnique>${UNIQUE}</mUnique>
<mLink>${URL}</mLink>
<mCheckSum>${HASH}</mCheckSum>
</model>
EOF
done < <(find "${MODEL_CONFIG_PATH}" -maxdepth 1 -name \*.yml | sort)
cat <<EOF
</item>
EOF