forked from josch/mmdebstrap
use Debian::DistroInfo if available
This commit is contained in:
parent
b2ea7b230f
commit
b7e257871d
1 changed files with 22 additions and 14 deletions
24
mmdebstrap
24
mmdebstrap
|
@ -3925,8 +3925,17 @@ sub get_sourceslist_by_suite {
|
||||||
$sourceslist .= "deb$signedby $mirror $suite-updates $compstr\n";
|
$sourceslist .= "deb$signedby $mirror $suite-updates $compstr\n";
|
||||||
# the security mirror changes, starting with bullseye
|
# the security mirror changes, starting with bullseye
|
||||||
# https://lists.debian.org/87r26wqr2a.fsf@43-1.org
|
# https://lists.debian.org/87r26wqr2a.fsf@43-1.org
|
||||||
|
my $bullseye_or_later = 0;
|
||||||
my $distro_info = '/usr/share/distro-info/debian.csv';
|
my $distro_info = '/usr/share/distro-info/debian.csv';
|
||||||
if (-f $distro_info) {
|
eval { require Debian::DistroInfo; };
|
||||||
|
if (!$@) {
|
||||||
|
# libdistro-info-perl is installed
|
||||||
|
my $debinfo = DebianDistroInfo->new();
|
||||||
|
if ($debinfo->version($suite, 0) >= 11) {
|
||||||
|
$bullseye_or_later = 1;
|
||||||
|
}
|
||||||
|
} elsif (-f $distro_info) {
|
||||||
|
# distro-info-data is installed
|
||||||
open my $fh, '<', $distro_info
|
open my $fh, '<', $distro_info
|
||||||
or error "cannot open $distro_info: $!";
|
or error "cannot open $distro_info: $!";
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
|
@ -3960,15 +3969,15 @@ sub get_sourceslist_by_suite {
|
||||||
}
|
}
|
||||||
close $fh;
|
close $fh;
|
||||||
if ($matching_version >= 11) {
|
if ($matching_version >= 11) {
|
||||||
# starting from bullseye use
|
$bullseye_or_later = 1;
|
||||||
$sourceslist
|
|
||||||
.= "deb$signedby $secmirror $suite-security" . " $compstr\n";
|
|
||||||
} else {
|
|
||||||
$sourceslist
|
|
||||||
.= "deb$signedby $secmirror $suite/updates" . " $compstr\n";
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
# neither libdistro-info-perl nor distro-info-data is installed
|
||||||
if (any { $_ eq $suite } ('bullseye', 'bookworm')) {
|
if (any { $_ eq $suite } ('bullseye', 'bookworm')) {
|
||||||
|
$bullseye_or_later = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($bullseye_or_later) {
|
||||||
# starting from bullseye use
|
# starting from bullseye use
|
||||||
$sourceslist
|
$sourceslist
|
||||||
.= "deb$signedby $secmirror $suite-security" . " $compstr\n";
|
.= "deb$signedby $secmirror $suite-security" . " $compstr\n";
|
||||||
|
@ -3977,7 +3986,6 @@ sub get_sourceslist_by_suite {
|
||||||
.= "deb$signedby $secmirror $suite/updates" . " $compstr\n";
|
.= "deb$signedby $secmirror $suite/updates" . " $compstr\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return $sourceslist;
|
return $sourceslist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue