Johannes Schauer Marin Rodrigues
5885291213
- only download Release files once and not by apt as well as with curl and thus avoid a mirror push happening between both downloads - no heuristic needed to place the file in their correct mirror location - no manual checksum checking - only throttle download speed when actually downloading and not when retrieving files from the cache - no translation of filenames between how the epoch colon is stored in files in /var/cache/apt/archives versus how it is stored in files on the mirrors - no special handling of stable update and security mirrors - implemented in Python instead of shell and thus an order of magnitude faster
13 lines
595 B
Bash
13 lines
595 B
Bash
#!/bin/sh
|
|
#
|
|
# make sure that using codenames works https://bugs.debian.org/1003191
|
|
|
|
set -eu
|
|
export LC_ALL=C.UTF-8
|
|
trap "rm -f InRelease; rm -rf /tmp/debian-chroot.tar /tmp/expected" EXIT INT TERM
|
|
/usr/lib/apt/apt-helper download-file "{{ MIRROR }}/dists/{{ DIST }}/InRelease" InRelease
|
|
codename=$(awk '/^Codename: / { print $2; }' InRelease)
|
|
{{ CMD }} --mode={{ MODE }} --variant=apt "$codename" /tmp/debian-chroot.tar {{ MIRROR }}
|
|
echo "deb {{ MIRROR }} $codename main" > /tmp/expected
|
|
tar --to-stdout --extract --file /tmp/debian-chroot.tar ./etc/apt/sources.list \
|
|
| diff -u /tmp/expected -
|