@@ -29,6 +29,7 @@ while getopts "sh" opt; do
2929 case " ${opt} " in
3030 s)
3131 SKIP=true
32+ shift
3233 ;;
3334 h)
3435 usage
4647cd " $( cd " ${0%/* } " && pwd -P) "
4748
4849IFS=' ' 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-} " )"
5052if [ ${# versions[@]} -eq 0 ]; then
5153 fatal " No valid versions found!"
5254fi
6567function in_versions_to_update() {
6668 local version=$1
6769
70+ if [ " ${# update_versions[@]} " -eq 0 ]; then
71+ echo 0
72+ return
73+ fi
74+
6875 for version_to_update in " ${update_versions[@]} " ; do
6976 if [ " ${version_to_update} " = " ${version} " ]; then
7077 echo 0
@@ -75,6 +82,24 @@ function in_versions_to_update() {
7582 echo 1
7683}
7784
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+
78103function update_node_version() {
79104
80105 local baseuri=${1}
@@ -164,9 +189,9 @@ for version in "${versions[@]}"; do
164189 parentpath=$( dirname " ${version} " )
165190 versionnum=$( basename " ${version} " )
166191 baseuri=$( get_config " ${parentpath} " " baseuri" )
167- update =$( in_versions_to_update " ${version} " )
192+ update_version =$( in_versions_to_update " ${version} " )
168193
169- [ " ${update } " -eq 0 ] && info " Updating version ${version} ..."
194+ [ " ${update_version } " -eq 0 ] && info " Updating version ${version} ..."
170195
171196 # Get supported variants according the target architecture
172197 # See details in function.sh
@@ -175,7 +200,7 @@ for version in "${versions[@]}"; do
175200 if [ -f " ${version} /Dockerfile" ]; then
176201 add_stage " ${baseuri} " " ${version} " " default"
177202
178- if [ " ${update } " -eq 0 ]; then
203+ if [ " ${update_version } " -eq 0 ]; then
179204 update_node_version " ${baseuri} " " ${versionnum} " " ${parentpath} /Dockerfile.template" " ${version} /Dockerfile" &
180205 fi
181206 fi
@@ -185,7 +210,9 @@ for version in "${versions[@]}"; do
185210 [ -f " ${version} /${variant} /Dockerfile" ] || continue
186211 add_stage " ${baseuri} " " ${version} " " ${variant} "
187212
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
189216 update_node_version " ${baseuri} " " ${versionnum} " " ${parentpath} /Dockerfile-${variant} .template" " ${version} /${variant} /Dockerfile" " ${variant} " &
190217 fi
191218 done
0 commit comments