Refactored logic to rewrite the Release file.

This commit is contained in:
Fabio Manganiello 2023-09-19 13:01:06 +02:00
parent e0da41e6ff
commit 9150b2cae5
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -477,6 +477,20 @@ steps:
- echo "-- Updating Release files" - echo "-- Updating Release files"
- | - |
add_hashes() {
dist_dir=$1
hash_cmd=$2
hash_label=$3
echo "$hash_label:"
find "$dist_dir" -name 'Packages*' | while read file; do
basename="$(echo "$file" | sed -r -e "s|^$dist_dir/||")"
hash="$($hash_cmd "$file" | cut -d" " -f1)"
size="$(wc -c < $file)"
echo " $hash $size $basename"
done
}
echo "stable\noldstable" | while read distro; do echo "stable\noldstable" | while read distro; do
dist_dir="$APT_ROOT/dists/$distro" dist_dir="$APT_ROOT/dists/$distro"
components=$(find "$dist_dir" -name Packages | awk -F '/' '{print $(NF-2)}' | uniq | tr '\n' ' ') components=$(find "$dist_dir" -name Packages | awk -F '/' '{print $(NF-2)}' | uniq | tr '\n' ' ')
@ -494,23 +508,9 @@ steps:
Date: $(date -Ru) Date: $(date -Ru)
EOF EOF
echo "MD5Sum:" >> "$release_file" add_hashes "$dist_dir" "md5sum" "MD5Sum" >> "$release_file"
find "$dist_dir" -name 'Packages*' | while read file; do add_hashes "$dist_dir" "sha1sum" "SHA1" >> "$release_file"
basename="$(echo "$file" | sed -r -e "s|^$dist_dir/(.*)|\1|")" add_hashes "$dist_dir" "sha256sum" "SHA256" >> "$release_file"
echo " $(md5sum "$file" | cut -d" " -f1) $(wc -c < $file) $basename"
done >> "$release_file"
echo "SHA1:" >> "$release_file"
find "$dist_dir" -name 'Packages*' | while read file; do
basename="$(echo "$file" | sed -r -e "s|^$dist_dir/(.*)|\1|")"
echo " $(sha1sum "$file" | cut -d" " -f1) $(wc -c < $file) $basename"
done >> "$release_file"
echo "SHA256:" >> "$release_file"
find "$dist_dir" -name 'Packages*' | while read file; do
basename="$(echo "$file" | sed -r -e "s|^$dist_dir/(.*)|\1|")"
echo " $(sha256sum "$file" | cut -d" " -f1) $(wc -c < $file) $basename"
done >> "$release_file"
done done
### ###