90-enable-repo: uncomment all matching lines; drop always-broken arch logic

This commit is contained in:
Gleb Fotengauer-Malinovskiy 2019-07-09 13:17:51 +03:00 committed by Michael Shigorin
parent f7b0b6fc92
commit e1ce4bd5a6

View File

@ -1,5 +1,5 @@
#!/bin/sh
# enable online repos if possible, just quit if anything's wrong
# enable online repos if possible, just quit if list is absent
repo_source='/etc/apt/sources.list.d/yandex.list'
@ -10,13 +10,4 @@ prefix_re="[[:space:]]*rpm[[:space:]]\+\([^[:space:]]\+[[:space:]]\+\)\?"
host_re="http:\/\/\([^[:space:]]\+\)[[:space:]]\+"
updates_re="${prefix_re}${host_re}\([^[:space:]]\+\/\)\?"
# architectures
host_arch="$(rpm --eval '%_arch')"
[ "$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
sed -i "s/^#\($updates_re\)/\1/" "$repo_source"