@@ -173,7 +173,17 @@ while [[ $URL != "" ]]; do
173
173
digestOld=$( echo " ${digestOld} " | sed -E ' /buildx\:/d' )
174
174
fi
175
175
if [[ " ${digestCurrent} " != " " ]]; then
176
- currentBuildFile=$( echo " ${digestCurrent} " | grep -oE ' ^sha256:.*$' | md5)
176
+ currentBuildFile=" "
177
+ if [[ " $( which md5) " != " " ]]; then
178
+ currentBuildFile=$( echo " ${digestCurrent} " | grep -oE ' ^sha256:.*$' | md5)
179
+ fi
180
+ if [[ " $( which md5sum) " != " " ]]; then
181
+ currentBuildFile=$( echo " ${digestCurrent} " | grep -oE ' ^sha256:.*$' | md5sum | grep -oE ' ^[^ ]+' )
182
+ fi
183
+ if [[ " ${currentBuildFile} " == " " ]]; then
184
+ echo " Cannot calculate md5 sum for the digestCurrent"
185
+ exit 1
186
+ fi
177
187
if [[ -f " ./buildx-data/index/${currentBuildFile} " ]]; then
178
188
digestBuildX=$(
179
189
echo " ${digestBuildX} " && \
@@ -182,7 +192,17 @@ while [[ $URL != "" ]]; do
182
192
fi
183
193
fi
184
194
if [[ " ${digestOld} " != " " ]]; then
185
- currentBuildFile=$( echo " ${digestOld} " | grep -oE ' ^sha256:.*$' | md5)
195
+ currentBuildFile=" "
196
+ if [[ " $( which md5) " != " " ]]; then
197
+ currentBuildFile=$( echo " ${digestOld} " | grep -oE ' ^sha256:.*$' | md5)
198
+ fi
199
+ if [[ " $( which md5sum) " != " " ]]; then
200
+ currentBuildFile=$( echo " ${digestOld} " | grep -oE ' ^sha256:.*$' | md5sum | grep -oE ' ^[^ ]+' )
201
+ fi
202
+ if [[ " ${currentBuildFile} " == " " ]]; then
203
+ echo " Cannot calculate md5 sum for the digestOld"
204
+ exit 1
205
+ fi
186
206
if [[ -f " ./buildx-data/index/${currentBuildFile} " ]]; then
187
207
digestBuildX=$(
188
208
echo " ${digestBuildX} " && \
@@ -243,8 +263,20 @@ while [[ $URL != "" ]]; do
243
263
fi && \
244
264
digestCurrent=$( echo " ${digestCurrent} " | sed -E ' /version:/d' && echo " version:${version} " ) && \
245
265
digestBuildX=$( cat ./buildx-data/index.json | jq -r ' .manifests[].digest' ) && \
246
- digestCurrent=$( echo " ${digestCurrent} " | sed -E ' /buildx:/d' && echo " buildx:${digestBuildX} " ) && \
247
- currentBuildFile=$( echo " ${digestCurrent} " | grep -oE ' ^sha256:.*$' | md5) && \
266
+ digestCurrent=$( echo " ${digestCurrent} " | sed -E ' /buildx:/d' && echo " buildx:${digestBuildX} " )
267
+
268
+ currentBuildFile=" "
269
+ if [[ " $( which md5) " != " " ]]; then
270
+ currentBuildFile=$( echo " ${digestCurrent} " | grep -oE ' ^sha256:.*$' | md5)
271
+ fi
272
+ if [[ " $( which md5sum) " != " " ]]; then
273
+ currentBuildFile=$( echo " ${digestCurrent} " | grep -oE ' ^sha256:.*$' | md5sum | grep -oE ' ^[^ ]+' )
274
+ fi
275
+ if [[ " ${currentBuildFile} " == " " ]]; then
276
+ echo " Cannot calculate md5 sum for the template"
277
+ exit 1
278
+ fi
279
+
248
280
echo " ${digestBuildX} " > " ./buildx-data/index/${currentBuildFile} " && \
249
281
rm Dockerfile
250
282
code=" ${?} "
0 commit comments