Skip to content

Commit 02164e9

Browse files
authored
fix #102: calculate expected file count correctly for optional checksum/signature files (#103)
* fix #102: -ns switch showed warning 'Expected to need to download 6 files but found 4' * log full download URL prefix
1 parent 41ef5b7 commit 02164e9

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

ubuntu-mainline-kernel.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ use_rc=0
7474
assume_yes=0
7575

7676
# (internal) How many files we expect to retrieve from the ppa
77-
# checksum, signature, header-all, header-arch, image(-unsigned), modules
78-
expected_files_count=6
77+
# header-all, header-arch, image(-unsigned), modules, checksum (optional), signature (optional)
78+
expected_files_count=4
7979

8080
# (internal) Which action/command the script should run
8181
run_action="help"
@@ -935,12 +935,22 @@ EOF
935935
done
936936
unset IFS
937937

938+
if [ $check_checksum -eq 1 ] || [ $check_signature -eq 1 ]; then
939+
if [ $uses_subfolders -eq 0 ]; then
940+
FILES+=("CHECKSUMS")
941+
else
942+
FILES+=("${arch}/CHECKSUMS")
943+
fi
944+
((expected_files_count++))
945+
fi
946+
938947
if [ $check_signature -eq 1 ]; then
939948
if [ $uses_subfolders -eq 0 ]; then
940-
FILES+=("CHECKSUMS" "CHECKSUMS.gpg")
949+
FILES+=("CHECKSUMS.gpg")
941950
else
942-
FILES+=("${arch}/CHECKSUMS" "${arch}/CHECKSUMS.gpg")
951+
FILES+=("${arch}/CHECKSUMS.gpg")
943952
fi
953+
((expected_files_count++))
944954
fi
945955

946956
if [ ${#FILES[@]} -ne $expected_files_count ]; then
@@ -956,7 +966,7 @@ EOF
956966
fi
957967

958968
debs=()
959-
log "Will download ${#FILES[@]} files from $ppa_host:"
969+
log "Will download ${#FILES[@]} files from https://$ppa_host$ppa_uri"
960970
for file in "${FILES[@]}"; do
961971
workfile=${file##*/}
962972
monitor_progress "Downloading $file" "$workdir$workfile"

0 commit comments

Comments
 (0)