From 58ae0bb97d0e7ebd6358663409b773a9d66a33af Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Tue, 10 Sep 2019 12:46:49 +0200 Subject: [PATCH] select the right mirror for ubuntu, kali and tanglu --- mmdebstrap | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index d905b07..0fdd6ee 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -2031,12 +2031,41 @@ sub main() { } } } else { - # FIXME: change default mirror depending on $suite - # (for derivatives) - $sourceslist .= "deb http://deb.debian.org/debian $suite $options->{components}\n"; - if (any { $_ eq $suite } ('stable', 'oldstable', 'stretch') ) { - $sourceslist .= "deb http://deb.debian.org/debian $suite-updates $options->{components}\n"; - $sourceslist .= "deb http://security.debian.org/debian-security $suite/updates $options->{components}\n"; + my @debstable = ('stable', 'oldstable', 'stretch', 'buster'); + my @ubuntustable = ('trusty', 'xenial', 'zesty', 'artful', 'bionic', 'cosmic'); + my @tanglustable = ('aequorea', 'bartholomea', 'chromodoris', 'dasyatis'); + my @kali = ('kali-dev', 'kali-rolling', 'kali-bleeding-edge'); + + my $mirror = 'http://deb.debian.org/debian'; + my $secmirror = 'http://security.debian.org/debian-security'; + if (any {$_ eq $suite} @ubuntustable) { + if (any {$_ eq $options->{nativearch}} ('amd64', 'i386')) { + $mirror = 'http://archive.ubuntu.com/ubuntu'; + $secmirror = 'http://archive.ubuntu.com/ubuntu'; + } else { + $mirror = 'http://ports.ubuntu.com/ubuntu-ports'; + $secmirror = 'http://ports.ubuntu.com/ubuntu-ports'; + } + } elsif (any {$_ eq $suite} @tanglustable) { + $mirror = 'http://archive.tanglu.org/tanglu' + } elsif (any {$_ eq $suite} @kali) { + $mirror = 'https://http.kali.org/kali' + } + $sourceslist .= "deb $mirror $suite $options->{components}\n"; + if (any {$_ eq $suite} @ubuntustable) { + $sourceslist .= "deb $mirror $suite-updates $options->{components}\n"; + $sourceslist .= "deb $secmirror $suite-updates $options->{components}\n"; + } elsif (any {$_ eq $suite} @tanglustable) { + $sourceslist .= "deb $secmirror $suite-updates $options->{components}\n"; + } elsif (any {$_ eq $suite} @debstable) { + $sourceslist .= "deb $mirror $suite-updates $options->{components}\n"; + if (any {$_ eq $suite} ('stable', 'oldstable', 'stretch', 'buster')) { + $sourceslist .= "deb $secmirror $suite/updates $options->{components}\n"; + } else { + # starting from bullseye use + # https://lists.debian.org/87r26wqr2a.fsf@43-1.org + $sourceslist .= "deb $secmirror $suite-security $options->{components}\n"; + } } } }