From 0bc397c02c0ea7c960b59ce92daa267bed23fc07 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 23 Jun 2022 18:17:41 +0200 Subject: [PATCH] Removing duplicates from md5sum.txt and computing new MD5 for changed files --- test/merge_debian_isos | 101 ++++++++++++++++++++++++++++++++++--- test/merge_debian_isos.sig | Bin 72 -> 72 bytes 2 files changed, 95 insertions(+), 6 deletions(-) diff --git a/test/merge_debian_isos b/test/merge_debian_isos index af940d80..02cdb63f 100755 --- a/test/merge_debian_isos +++ b/test/merge_debian_isos @@ -434,6 +434,7 @@ do MOUNT_LIST="$MOUNT_LIST $mount_point" done +echo "Done." >&2 echo >&2 echo "Copying dists directory and md5sum.txt from first ISO ..." >&2 @@ -473,6 +474,7 @@ else echo "--- Could not copy /md5sum.txt from first ISO." >&2 cleanup_and_end 3 fi +echo "Done." >&2 ## Helper functions @@ -516,6 +518,84 @@ extract_release_head() { done } +# Decide whether to re-compute MD5 and whether to put out the md5sum line +# Parameters: prev_path prev_md5 +check_and_put_out_md5_grep() { + + if echo "$prev_path" | grep '^\.\/pool\/' >/dev/null 2>&1 + then + echo "$prev_md5 $prev_path" + return 0 + fi + if echo "$prev_path" | grep '^\.\/firmware\/' >/dev/null 2>&1 + then + if test "$was_multiple" = 1 + then + # There is the risk that the surviving file does not match prev_md5. + # Better omit it. + dummy=dummy + else + echo "$prev_md5 $prev_path" + fi + return 0 + fi + + if echo "$prev_path" | grep '^\.\/dists\/' >/dev/null 2>&1 + then + md5_path="$(echo -n "$prev_path" | sed -e 's/^\.\//merged_/')" + prev_md5="$(md5sum <"$md5_path" | awk '{print $1}')" + elif test "$prev_path" = ./README.txt + then + prev_md5="$(md5sum &2 @@ -619,12 +699,6 @@ echo "Done." >&2 echo >&2 echo "Merging package description files ..." >&2 -# /md5sum.txt seems to be the only overall package list -for i in $MOUNT_LIST -do - cat "$i"/md5sum.txt -done | sort -k 2 >merged_md5sum.txt - # Determine the files which are mentioned with checksum in main Release files path_list=$(for i in $MOUNT_LIST do @@ -677,6 +751,7 @@ continue fi done +echo "Done." >&2 ## Update dists/"$dist"/Release @@ -720,6 +795,20 @@ mv temp_file merged_dists/"$dist"/Release echo "Done." >&2 +## Merge md5sum.txt and compute the MD5s which might have changed +echo >&2 +echo "Merging md5sum.txt files ..." >&2 + +for i in $MOUNT_LIST +do + cat "$i"/md5sum.txt +done | sort -k 2 >merged_md5sum.txt + +polish_md5sum_txt >temp_file +mv temp_file merged_md5sum.txt +echo "Done." >&2 + + ## Produce the new ISO image echo >&2 echo "Producing result ISO image ..." >&2 diff --git a/test/merge_debian_isos.sig b/test/merge_debian_isos.sig index 32148eed45ede5c645b2a0a415d4110b4c71c327..956dc495e035700b0362feb75bc116d761b973af 100644 GIT binary patch literal 72 zcmV-O0Jr~$Mg#y60ssaD0%Ek0-~b8<5b4X`z^lNhR0=czo