diff options
author | Georgi Georgiev <310867+chutzimir@users.noreply.github.com> | 2022-07-07 05:34:17 +0300 |
---|---|---|
committer | Georgi Georgiev <310867+chutzimir@users.noreply.github.com> | 2022-07-07 05:34:17 +0300 |
commit | 0d4c272e4ff06ba0e941b730d58a86f332381f80 (patch) | |
tree | b2ec9d5a004daeec3f64e6f9855ba1b793d5661c | |
parent | 87cbcd203a5e77c3867cf4f6a9e4db00ae3005a4 (diff) |
Support repositories without Release files
This allows to mirror a repo like
```
deb https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64/ /
```
which has an `InRelease` file, but no `Release` file.
-rwxr-xr-x | apt-mirror | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -514,19 +514,27 @@ sub find_metadata_in_release else { $dist_uri = remove_double_slashes($uri . "/" . $distribution . "/"); } - $release_uri = $dist_uri . "Release"; - $release_path = get_variable("skel_path") . "/" . sanitise_uri($release_uri); - unless ( open STREAM, "<$release_path" ) + my $stream; + foreach my $release_filename ("InRelease", "Release") { - warn( "Failed to open Release file from " . $release_uri ); + $release_uri = $dist_uri . $release_filename; + $release_path = get_variable("skel_path") . "/" . sanitise_uri($release_uri); + + last if ( open $stream, "<", $release_path); + $stream = undef; + } + + unless ( $stream ) + { + warn( "Failed to find InRelease or Release in " . get_variable("skel_path") . "/" . sanitise_uri($dist_uri) ); return; } my $checksums = 0; my $acquire_by_hash = 0; my @parts_to_download = (); - while ( $line = <STREAM> ) + while ( $line = <$stream> ) { chomp $line; if ($checksums) @@ -606,6 +614,7 @@ sub find_metadata_in_release } } } + close $stream; foreach (@parts_to_download) { my ( $sha256, $size, $filename ) = @{$_}; |