From e828111ff7094354da6d55e1bc19d2d8decf3d6d Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Sat, 30 Mar 2024 06:18:07 +0200 Subject: feat(arch-nspawn): add support for pacman CacheServer pacman 6.1 added support for CacheServer which allows us to download packages faster and reduce the burden on tier0 server. They won't be used to fetch databases so it should be pretty safe in the repository consistency context. Component: arch-nspawn --- src/arch-nspawn.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/arch-nspawn.in b/src/arch-nspawn.in index 2318813..a4504a1 100644 --- a/src/arch-nspawn.in +++ b/src/arch-nspawn.in @@ -72,6 +72,7 @@ fi # shellcheck disable=2016 host_mirrors=($(pacman-conf --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')) +host_cachemirrors=($(pacman-conf --repo extra CacheServer 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')) for host_mirror in "${host_mirrors[@]}"; do if [[ $host_mirror == *file://* ]]; then @@ -106,6 +107,8 @@ copy_hostconf () { printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist" + [[ -n $host_cachemirrors ]] && printf 'CacheServer = %s\n' "${host_cachemirrors[@]}" >>"$working_dir/etc/pacman.d/mirrorlist" + [[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf" [[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf" -- cgit v1.2.3-70-g09d2