@@ -29,6 +29,7 @@ while getopts "sh" opt; do
29
29
case " ${opt} " in
30
30
s)
31
31
SKIP=true
32
+ shift
32
33
;;
33
34
h)
34
35
usage
46
47
cd " $( cd " ${0%/* } " && pwd -P) "
47
48
48
49
IFS=' ' read -ra versions <<< " $(get_versions .)"
49
- IFS=' ' read -ra update_versions <<< " $(get_versions . " $@ " )"
50
+ IFS=' ' read -ra update_versions <<< " $(get_versions . " ${1-} " )"
51
+ IFS=' ' read -ra update_variants <<< " $(get_variants . " ${2-} " )"
50
52
if [ ${# versions[@]} -eq 0 ]; then
51
53
fatal " No valid versions found!"
52
54
fi
65
67
function in_versions_to_update() {
66
68
local version=$1
67
69
70
+ if [ " ${# update_versions[@]} " -eq 0 ]; then
71
+ echo 0
72
+ return
73
+ fi
74
+
68
75
for version_to_update in " ${update_versions[@]} " ; do
69
76
if [ " ${version_to_update} " = " ${version} " ]; then
70
77
echo 0
@@ -75,6 +82,24 @@ function in_versions_to_update() {
75
82
echo 1
76
83
}
77
84
85
+ function in_variants_to_update() {
86
+ local variant=$1
87
+
88
+ if [ " ${# update_variants[@]} " -eq 0 ]; then
89
+ echo 0
90
+ return
91
+ fi
92
+
93
+ for variant_to_update in " ${update_variants[@]} " ; do
94
+ if [ " ${variant_to_update} " = " ${variant} " ]; then
95
+ echo 0
96
+ return
97
+ fi
98
+ done
99
+
100
+ echo 1
101
+ }
102
+
78
103
function update_node_version() {
79
104
80
105
local baseuri=${1}
@@ -164,9 +189,9 @@ for version in "${versions[@]}"; do
164
189
parentpath=$( dirname " ${version} " )
165
190
versionnum=$( basename " ${version} " )
166
191
baseuri=$( get_config " ${parentpath} " " baseuri" )
167
- update =$( in_versions_to_update " ${version} " )
192
+ update_version =$( in_versions_to_update " ${version} " )
168
193
169
- [ " ${update } " -eq 0 ] && info " Updating version ${version} ..."
194
+ [ " ${update_version } " -eq 0 ] && info " Updating version ${version} ..."
170
195
171
196
# Get supported variants according the target architecture
172
197
# See details in function.sh
@@ -175,7 +200,7 @@ for version in "${versions[@]}"; do
175
200
if [ -f " ${version} /Dockerfile" ]; then
176
201
add_stage " ${baseuri} " " ${version} " " default"
177
202
178
- if [ " ${update } " -eq 0 ]; then
203
+ if [ " ${update_version } " -eq 0 ]; then
179
204
update_node_version " ${baseuri} " " ${versionnum} " " ${parentpath} /Dockerfile.template" " ${version} /Dockerfile" &
180
205
fi
181
206
fi
@@ -185,7 +210,9 @@ for version in "${versions[@]}"; do
185
210
[ -f " ${version} /${variant} /Dockerfile" ] || continue
186
211
add_stage " ${baseuri} " " ${version} " " ${variant} "
187
212
188
- if [ " ${update} " -eq 0 ]; then
213
+ update_variant=$( in_variants_to_update " ${variant} " )
214
+
215
+ if [ " ${update_version} " -eq 0 ] && [ " ${update_variant} " -eq 0 ]; then
189
216
update_node_version " ${baseuri} " " ${versionnum} " " ${parentpath} /Dockerfile-${variant} .template" " ${version} /${variant} /Dockerfile" " ${variant} " &
190
217
fi
191
218
done
0 commit comments