|
168 | 168 |
|
169 | 169 | content_index_file_prev_md5_hash=( $(md5sum -b "$content_index_file") ) |
170 | 170 |
|
171 | | -TEMP_DIR="$(mktemp -d)" |
| 171 | +# drop forwarding backslash: https://unix.stackexchange.com/questions/424628/md5sum-prepends-to-the-checksum |
| 172 | +# |
| 173 | +content_index_file_prev_md5_hash="${content_index_file_prev_md5_hash#\\}" |
| 174 | +
|
| 175 | +if [[ -z "$TEMP_DIR" ]]; then # otherwise use exterenal TEMP_DIR |
| 176 | + TEMP_DIR="$(mktemp -d)" |
172 | 177 |
|
173 | | -tkl_push_trap 'rm -rf "$TEMP_DIR"' EXIT |
| 178 | + tkl_push_trap 'rm -rf "$TEMP_DIR"' EXIT |
| 179 | +fi |
174 | 180 |
|
175 | 181 | stats_failed_inc=0 |
176 | 182 | stats_skipped_inc=0 |
@@ -292,6 +298,10 @@ for i in $("${YQ_CMDLINE_READ[@]}" '."content-config".entries[0].dirs|keys|.[]' |
292 | 298 | if (( is_index_file_prev_exist )); then |
293 | 299 | # to update the file hash in the index file |
294 | 300 | index_file_next_md5_hash=( $(md5sum -b "$index_dir/$index_file") ) |
| 301 | +
|
| 302 | + # drop forwarding backslash: https://unix.stackexchange.com/questions/424628/md5sum-prepends-to-the-checksum |
| 303 | + # |
| 304 | + index_file_next_md5_hash="${index_file_next_md5_hash#\\}" |
295 | 305 | fi |
296 | 306 |
|
297 | 307 | if (( ! is_file_expired )); then |
@@ -393,6 +403,10 @@ for i in $("${YQ_CMDLINE_READ[@]}" '."content-config".entries[0].dirs|keys|.[]' |
393 | 403 |
|
394 | 404 | index_file_next_md5_hash=( $(md5sum -b "$TEMP_DIR/content/$index_dir/$index_file") ) |
395 | 405 |
|
| 406 | + # drop forwarding backslash: https://unix.stackexchange.com/questions/424628/md5sum-prepends-to-the-checksum |
| 407 | + # |
| 408 | + index_file_next_md5_hash="${index_file_next_md5_hash#\\}" |
| 409 | +
|
396 | 410 | if [[ "$index_file_next_md5_hash" != "$index_file_prev_md5_hash" ]]; then |
397 | 411 | echo "File MD5 hash is changed: new=\`$index_file_next_md5_hash\` prev=\`$index_file_prev_md5_hash\`" |
398 | 412 | else |
@@ -441,6 +455,10 @@ done |
441 | 455 |
|
442 | 456 | content_index_file_next_md5_hash=( $(md5sum -b "$content_index_file") ) |
443 | 457 |
|
| 458 | +# drop forwarding backslash: https://unix.stackexchange.com/questions/424628/md5sum-prepends-to-the-checksum |
| 459 | +# |
| 460 | +content_index_file_next_md5_hash="${content_index_file_next_md5_hash#\\}" |
| 461 | +
|
444 | 462 | if (( stats_changed_inc )) || [[ "$content_index_file_next_md5_hash" != "$content_index_file_prev_md5_hash" ]]; then |
445 | 463 | { |
446 | 464 | # update index file change timestamp |
|
0 commit comments