From 6bdc95424ffb7bda0d03c5e0e0534874b7ce84f4 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 7 Aug 2024 18:13:20 +0200 Subject: liste-verfuegbare-Versionen: on artix pull db from cache server --- liste-verfuegbare-Versionen | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'liste-verfuegbare-Versionen') diff --git a/liste-verfuegbare-Versionen b/liste-verfuegbare-Versionen index c3362ae81..185329670 100755 --- a/liste-verfuegbare-Versionen +++ b/liste-verfuegbare-Versionen @@ -2,19 +2,30 @@ provided=$(mktemp) -sources=( - /var/lib/pacman/sync - /mnt/archlinux/archlinux - /mnt/archlinux -) - -sudo pacman -Sy >/dev/null || exit $? +if grep -qxF 'ID=arch' /etc/os-release; then + sources=( + /var/lib/pacman/sync + /mnt/archlinux/archlinux + /mnt/archlinux + ) + sudo pacman -Sy >/dev/null || exit $? +else + sources=( + http://pkgcache.eckner.net/arch/x86_64/core/core.db.tar.gz + http://pkgcache.eckner.net/arch/x86_64/extra/extra.db.tar.gz + ) +fi for i in "${!sources[@]}"; do source="${sources["${i}"]}" - find "${source}" -name '*.db' \ - -exec bsdtar -Oxzf {} \; \ - 2>/dev/null \ + if [ -z "${source##*://*}" ]; then + curl -Ss "${source}" \ + | bsdtar -Oxzf + else + find "${sources["${i}"]}" -name '*.db' \ + -exec bsdtar -Oxzf {} \; \ + 2>/dev/null \ + fi \ | sed -n ' /^%\(NAME\|VERSION\)%$/ { N -- cgit v1.2.3-70-g09d2