mkimage-profiles/features.in/repo/image-scripts.d/90-enable-repo
Anton Midyukov 1b457a5d85 90-enable-repo: use ftp.altlinux.org as default mirror
Yandex mirror can lag behind at times:
http://mirmon.altlinux.org/sisyphus.html#ru

...and we've got 1GbE there now, not that bad
compared to 100Mbps back then...

NB: yandex traffic might be billed as "local"
    in many regions, this should be revisited.
2019-01-14 17:31:20 +03:00

23 lines
743 B
Bash
Executable File

#!/bin/sh
# enable online repos if possible, just quit if anything's wrong
repo_source='/etc/apt/sources.list.d/alt.list'
[ -s "$repo_source" ] || exit 0
# regexps from alterator-pkg (via installer-feature-online-repo)
prefix_re="[[:space:]]*rpm[[:space:]]\+\([^[:space:]]\+[[:space:]]\+\)\?"
host_re="http:\/\/\([^[:space:]]\+\)[[:space:]]\+"
updates_re="${prefix_re}${host_re}\([^[:space:]]\+\/\)\?"
# architectures
host_arch="$(rpm --eval '%_host_cpu')"
[ "$host_arch" = "x86_64" ] && compat="x86_64-i586" || compat=
[ "$host_arch" = 'armh' ] && noarch= || noarch='noarch'
# turn on unconditionally
for arch in "$host_arch" "$noarch" "$compat"; do
[ -n "$arch" ] || continue
sed -i "s/^#\($updates_re$arch\)/\1/" "$repo_source"
done