Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2022-10-08 14:45:10 +08:00
374 changed files with 10474 additions and 13270 deletions

View File

@ -70,29 +70,30 @@ sub hash_cmd() {
return undef;
}
sub tool_present {
my $tool_name = shift;
my $compare_line = shift;
my $present = 0;
if (open TOOL, "$tool_name --version 2>/dev/null |") {
if (defined(my $line = readline TOOL)) {
$present = 1 if $line =~ /^$compare_line /;
}
close TOOL;
}
return $present
}
sub download_cmd {
my $url = shift;
my $have_curl = 0;
my $have_aria2c = 0;
my $filename = shift;
my $additional_mirrors = join(" ", map "$_/$filename", @_);
my @chArray = ('a'..'z', 'A'..'Z', 0..9);
my $rfn = join '', "${filename}_", map{ $chArray[int rand @chArray] } 0..9;
if (open CURL, '-|', 'curl', '--version') {
if (defined(my $line = readline CURL)) {
$have_curl = 1 if $line =~ /^curl /;
}
close CURL;
}
if (open ARIA2C, '-|', 'aria2c', '--version') {
if (defined(my $line = readline ARIA2C)) {
$have_aria2c = 1 if $line =~ /^aria2 /;
}
close ARIA2C;
}
if ($have_aria2c) {
if (tool_present('aria2c', 'aria2')) {
@mirrors=();
return join(" ", "[ -d $ENV{'TMPDIR'}/aria2c ] || mkdir $ENV{'TMPDIR'}/aria2c;",
"touch $ENV{'TMPDIR'}/aria2c/${rfn}_spp;",
@ -103,7 +104,7 @@ sub download_cmd {
"-d $ENV{'TMPDIR'}/aria2c -o $rfn;",
"cat $ENV{'TMPDIR'}/aria2c/$rfn;",
"rm $ENV{'TMPDIR'}/aria2c/$rfn $ENV{'TMPDIR'}/aria2c/${rfn}_spp");
} elsif ($have_curl) {
} elsif (tool_present('curl', 'curl')) {
return (qw(curl -f --connect-timeout 20 --retry 5 --location),
$check_certificate ? () : '--insecure',
shellwords($ENV{CURL_OPTIONS} || ''),
@ -236,6 +237,8 @@ foreach my $mirror (@ARGV) {
push @mirrors, "https://ftp.debian.org/debian/$1";
push @mirrors, "https://mirror.leaseweb.com/debian/$1";
push @mirrors, "https://mirror.netcologne.de/debian/$1";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/debian/$1";
push @mirrors, "https://mirrors.ustc.edu.cn/debian/$1"
} elsif ($mirror =~ /^\@APACHE\/(.+)$/) {
push @mirrors, "https://mirrors.tencent.com/apache/$1";
push @mirrors, "https://mirrors.aliyun.com/apache/$1";
@ -250,6 +253,8 @@ foreach my $mirror (@ARGV) {
push @mirrors, "http://ftp.jaist.ac.jp/pub/apache/$1";
push @mirrors, "ftp://apache.cs.utah.edu/apache.org/$1";
push @mirrors, "ftp://apache.mirrors.ovh.net/ftp.apache.org/dist/$1";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/apache/$1";
push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1";
} elsif ($mirror =~ /^\@GITHUB\/(.+)$/) {
my $dir = $1;
my $i = 0;
@ -276,6 +281,8 @@ foreach my $mirror (@ARGV) {
push @mirrors, "ftp://mirrors.rit.edu/gnu/$1";
push @mirrors, "ftp://download.xs4all.nl/pub/gnu/$1";
push @mirrors, "https://ftp.gnu.org/gnu/$1";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/gnu/$1";
push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1";
} elsif ($mirror =~ /^\@SAVANNAH\/(.+)$/) {
push @mirrors, "https://mirror.netcologne.de/savannah/$1";
push @mirrors, "https://mirror.csclub.uwaterloo.ca/nongnu/$1";
@ -301,6 +308,8 @@ foreach my $mirror (@ARGV) {
push @mirrors, "http://www.ring.gr.jp/archives/linux/kernel.org/$dir";
push @mirrors, "ftp://ftp.riken.jp/Linux/kernel.org/$dir";
push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir";
push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/kernel/$dir";
push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir";
}
} elsif ($mirror =~ /^\@GNOME\/(.+)$/) {
# push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1";
@ -313,6 +322,7 @@ foreach my $mirror (@ARGV) {
push @mirrors, "http://ftp.belnet.be/ftp.gnome.org/sources/$1";
push @mirrors, "ftp://ftp.cse.buffalo.edu/pub/Gnome/sources/$1";
push @mirrors, "ftp://ftp.nara.wide.ad.jp/pub/X11/GNOME/sources/$1";
push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1";
} else {
push @mirrors, $mirror;
}