161 Commits

Author SHA1 Message Date
0abe3734b2 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-07-27 16:54:27 +08:00
685fc753a7 download: add support for gitweb snapshots
When downloading a snapshot archive from gitweb,
the filename is not part of the URL,
and adding the filename to the URL causes errors.

The gitweb API exclusively uses query parameters
instead of paths in order to execute snapshot downloads.

Add a condition to the Perl download script
that removes the filename if the relevant
query parameter matches in the URL.

Also, to reduce server load of the original sources
try the Openwrt CDN servers first for these downloads.

Even though snapshot downloads are not ideal
due to the impact on the source's server health,
they are better for download performance than using git only.
Therefore, attempting it last will reduce the impact
and thus encourage maintainers to keep the option enabled.

This change is partly inspired by a conversation linked below
about snapshot downloads and server performance issues
which led to the feature being disabled for a particular server.

Link: https://lists.gnu.org/archive/html/bug-gnulib/2024-12/msg00124.html
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-07-26 14:38:08 +02:00
07159cc25a Revert "scripts/download.pl: read file natively"
This reverts commit 65560de58d.

Seems to broke CI and require more testing.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-10-27 15:58:16 +01:00
65560de58d scripts/download.pl: read file natively
Read files natively instead of execing /bin/cat.

Signed-off-by: Matteo Croce <teknoraver@meta.com>
Link: https://github.com/openwrt/openwrt/pull/16784
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-10-27 14:24:32 +01:00
c7f1ca5117 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-10-13 14:17:59 +08:00
6e40f98208 scripts/download.pl: use perl builtins instead of system()
Perl natively supports renaming files and create directories.
Do it without calling system().

Signed-off-by: Matteo Croce <teknoraver@meta.com>
Link: https://github.com/openwrt/openwrt/pull/16542
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-10-12 21:59:15 +02:00
7eb590a3a4 download.pl: try immortalwrt mirror firstly
Fixes: db35b0ef9f ("Merge Official Source")
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-07-15 11:34:01 +08:00
db35b0ef9f Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-06-21 02:27:01 +08:00
3b83d393dd scripts/download.pl: fix broken link for KERNEL projects
Fix broken link generation for KERNEL projects.

Using $1 in projectsmirrors sub was still referencing the caller $1
instead of the remaining args of projectsmirrors sub.

Use shift and put the second arg of projectsmirrors sub in $append to
correctly handle the sub args.

Fixes: 465cf35888 ("scripts/download.pl: detach mirror URLs from script file")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-19 14:30:06 +02:00
465cf35888 scripts/download.pl: detach mirror URLs from script file
Detach URL from download script to make it easier to change and update
the URLs.

The mirror list is moved to a JSON file in the scripts directory called
projectsmirrors.json.

Link: https://github.com/openwrt/openwrt/pull/15745
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-18 19:51:45 +02:00
9968354df0 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-05-30 14:41:34 +08:00
6510eb3b5d scripts: Add GNU ftp mirror redirector for GNU and Savannah
Add GNU's redirector which automatically redirect user to nearby online
mirror.

Signed-off-by: Sahil Dhiman <sahil@hopbox.in>
Link: https://github.com/openwrt/openwrt/pull/15557
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-29 11:19:08 +02:00
7b72cd5093 scripts/download.pl: remove deprecated onedrive mirror
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-03-30 21:15:06 +08:00
3ea268343a Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-09-16 21:52:11 +08:00
e39fd02347 scripts/download.pl: Remove stale download sites and convert to https
Remove the stale site definitions from @APACHE, KERNEL etc.

* Remove site that had dropped APACHE
* Remove KERNEL site leading to wrong directory
* Remove dead sites
* Convert ftp/http URLs to https, if possible. Remove duplicate

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2023-09-16 12:10:22 +02:00
b822e2dc62 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-09-02 08:43:34 +08:00
402212c3b0 scripts/download.pl: remove stale GNOME download sites
Remove stale sites from @GNOME alias:
* remove 2 sites that have stale 3 years old content
* remove 2 sites that have dropped GNOME
* convert 2 sites from FTP to HTTP

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2023-09-01 23:09:43 +02:00
a32e32a1e3 download.pl: remove duplicate mirrors
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-08-15 15:28:38 +08:00
3ddf2d6612 download.pl: update cdn domain
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-03-15 17:44:32 +08:00
8190433295 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-01-07 16:43:13 +08:00
9ac377d0e0 scripts: add Apache fastly mirror
Add the Apache fastly mirror as preferred download source.
This service is using a dual-stacked CDN.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-01-07 01:32:58 +01:00
9b3db09fe3 download.pl: fix typo error
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-12-11 22:37:35 +08:00
3d37d7b1c0 scripts/download.pl: update mirrors
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-12-11 13:44:25 +08:00
4fb0bd80d5 Revert "download.pl: remove broken mirror"
mirror2 now points to mirrors.gigenet.com.

This reverts commit 9fbf1751ec.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-12-11 12:51:49 +08:00
d6b6dbf9e1 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-10-21 15:59:03 +08:00
a53f29b583 scripts/download.pl: pass aria2 config in ENV only
The aria2c command tries to load config from
${XDG_CONFIG_HOME:-${HOME}/.config}/aria2/aria2.conf by default,
which may result unexpected behavior.

As a replacement, people can use environment variable ARIA2C_OPTIONS
to custom arguments passed to aria2c like curl and wget below.
Including --conf-path=/path/to/config.conf in ARIA2C_OPTIONS can
also set a custom config file path easily if needed.

Signed-off-by: Zhang Hua <zhanghuadedn@gmail.com>
2022-10-20 20:38:31 +02:00
f17608ddca scripts/download.pl: make the download tool configurable
Introduce a new option in the "Advanced configuration options" to
configure a custom download tool.

By declaring a string in "Use custom download tool" an user can force
what command to use to download package. With the string empty the
default tool used is curl, with wget as a fallback if not available.

download.pl supports 3 tools officially aria2c, curl and wget.
If one of the tool is used in this config, download.pl will use the
default args to make use of them.

If the provided string is different than aria2c, curl or wget, the command
is used as is and the download url will be appended at the end of such command.

While at it also tweak the tool selection logic and chose the tool only
once when the script is called and move aria2c specific variables in the
relevant section.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-10-20 00:35:19 +02:00
9d6e3e6c02 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-10-08 14:46:37 +08:00
e937663025 scripts/download.pl: add tsinghua and ustc mirrors
Add https://mirrors.tuna.tsinghua.edu.cn/ and https://mirrors.ustc.edu.cn/ mirrors into download.pl to speed up download in China.

Signed-off-by: Bradford Zhang <zyc@zyc.name>
2022-09-30 14:57:19 +02:00
261925a869 scripts/download.pl: generilize and simplify download tool check
Generilize download tool check and skip other check if a download tool
has been found.
While at it also reintroduce c836ca84e8
that was previously dropped with aria2c support.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-28 16:55:10 +02:00
81f9f50fa4 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-09-27 17:06:04 +08:00
f1b3958d02 scripts/download.pl: fix support for aria2c download tool on macos
Currently we use /dev/shm to place aria2c tmp file. This is not present
on macos. Use the openwrt tmp directory instead of the linux-only
/dev/shm to save compatibility with more os.

Fixes: d391236269 ("download.pl: add aria2c support")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-26 20:50:10 +02:00
5df60f5c24 scripts/download.pl: fix mirrors regression for curl and wget
With the introduction of aria2c support, curl and wget no longer try to
download the file from mirrors. Fix this regression by emptying the
remaining mirrors list only when aria2c is used.

Fixes: d391236269 ("download.pl: add aria2c support")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-26 20:50:09 +02:00
295e0ed7a9 scripts/download.pl: fix whitespace in mirror urls and drop for
Fix whitespace in mirror urls and replace for loop with join+map logic.

Fixes: d391236269 ("download.pl: add aria2c support")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-25 15:54:12 +02:00
d391236269 download.pl: add aria2c support
Use aria2c download tool by default on package download if available in
the system.
aria2c permits to use multiple mirrors and may improve download speed on
special context where servers are hard to reach.

Co-authored-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Bradford Zhang <zyc@zyc.name>
[ fix wrong var in the script and improve commit description ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-25 14:56:45 +02:00
165b0899d4 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-09-16 15:32:20 +08:00
50a48faa1b scripts/download.pl: fix downloads with wget
Several users of wget for downloads (curl is not available in the
system) have reported broken download functionality:

 wget --tries=5 --timeout=20 --output-document=-  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.142.tar.xz
 http://: Invalid host name.

Thats all happening due to '' was passed as an argument, which got later
expanded to http://.

In the context of a list constructor '' is not nothing, it is an empty
string element.  So fix it by using () as it will yield "nothing" and
thus not introduce an empty string element.

Fixes: #10692
Fixes: 90c6e3aedf ("scripts: always check certificates")
Signed-off-by: Jo-Philipp Wich <jo@mein.io> [shellwords() -> ()]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-09-13 09:14:09 +02:00
c836ca84e8 scripts/download.pl: silence can't exec curl warning
When running build in verbose mode `make V=s` we can see a lot of
following warnings when curl is not available in the system:

 Can't exec "curl": No such file or directory at scripts/download.pl line 77.

So lets fix it by redirecting of the stderr to null hole.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-09-13 09:14:09 +02:00
90c6e3aedf scripts: always check certificates
Remove flags from wget and curl instructing them to ignore bad server
certificates. Although other mechanisms can protect against malicious
modifications of downloads, other vectors of attack may be available
to an adversary.

TLS certificate verification can be disabled by turning oof the
"Enable TLS certificate verification during package download" option
enabled by default in the "Global build settings" in "make menuconfig"

Signed-off-by: Josh Roys <roysjosh@gmail.com>
[ add additional info on how to disable this option ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2022-09-10 15:24:22 +02:00
9fbf1751ec download.pl: remove broken mirror
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-08-06 18:49:52 +08:00
a190804949 download.pl: add ImmortalWrt fallback
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-07-12 15:29:29 +08:00
02edeb1469 scripts/download.pl: drop broken mirror
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-05-06 22:10:58 +08:00
0ea2f57158 scripts/download.pl: add CN mirrors for DEBIAN
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-04-13 03:34:03 +08:00
7807fb0119 scripts/download.pl: drop cqu mirror
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-03-17 19:59:49 +08:00
4ca3aeca5b Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-03-13 13:44:48 +08:00
6b822189b1 toolchain: binutils: add support for version 2.38
While at it, also fix the download.xs4all.nl and add ftp.gnu.org to the GNU
mirrors, as it seems to be updated faster.

Deleted (upstreamed):
600-Close_the_file_descriptor.patch [1]

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5a98fb7513b559e20dfebdbaa2a471afda3b4742

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-03-09 10:23:25 +00:00
5b8437bf43 Merge Official Source
Keep iptables for now.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2022-01-24 19:03:56 +08:00
88204bfa82 treewide: drop use of which
Ubuntu started to flag which as deprecated and it
seems which is not really standard and may vary
across Distro.
Drop the use of which and use the standard 'command -v'
for this simple task.
Which is still present in the prereq if some package/script
still use which.
A utility script called command_all.sh is implemented that
will just mimic the output of which -a.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-01-17 09:14:26 +01:00
13c56d272d scripts/download.pl: add new mirror
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2021-11-30 20:14:11 +08:00
9401c4c042 scripts/download.pl: tweak default mirrors
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2021-11-29 13:24:32 +08:00