From patchwork Tue Jul 31 18:25:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Hesse X-Patchwork-Id: 710 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id DC1ED5DA0673 for ; Tue, 31 Jul 2018 18:26:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED=0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,T_DKIM_INVALID=1 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.0.10] [127.0.0.10] [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Tue, 31 Jul 2018 18:26:19 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 7A438C7B26DEF; Tue, 31 Jul 2018 18:26:14 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Tue, 31 Jul 2018 18:26:14 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 4F00D2AE53; Tue, 31 Jul 2018 18:26:14 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=eworm.de header.i=@eworm.de header.b=P9WIedjj Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 5ECB42AE26 for ; Tue, 31 Jul 2018 18:26:11 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Tue, 31 Jul 2018 18:26:11 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 13A73C7B226BD for ; Tue, 31 Jul 2018 18:26:06 +0000 (UTC) Received: from mx.mylinuxtime.de (mx.mylinuxtime.de [195.201.174.144]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Tue, 31 Jul 2018 18:26:06 +0000 (UTC) Received: from leda.eworm.de (p5B101F4A.dip0.t-ipconnect.de [91.16.31.74]) (using TLSv1.2 with cipher DHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx.mylinuxtime.de (Postfix) with ESMTPSA id C4645DA7; Tue, 31 Jul 2018 20:26:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mx.mylinuxtime.de C4645DA7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eworm.de; s=mail; t=1533061565; bh=Q+khtc7xE+IB4pqm9yzJd2Be2nXpZSloYnWrzuqIVFo=; h=From:To:Cc:Subject:Date; b=P9WIedjj44W+BpSVq0HHIdNbUQveM+2X+Vc29IlG6ua/U2WXfp6UaeupPP/O9y1sK JQZE90HdVvOtsRH3t3FavzERmIFFcjQTU+TFgFIlPF81WsYjPoExii6dczmhVNpmtT y2/j9/OpndOlWUu6sC1HbbbCiH3qAMvNKsx6xI5c= Received: by leda.eworm.de (Postfix, from userid 1000) id BC3CD102A7B; Tue, 31 Jul 2018 20:25:34 +0200 (CEST) From: Christian Hesse To: arch-projects@archlinux.org Date: Tue, 31 Jul 2018 20:25:30 +0200 Message-Id: <20180731182530.11870-1-list@eworm.de> X-Mailer: git-send-email 2.18.0 Subject: [arch-projects] [devtools] [PATCH 1/1] arch-nspawn: get all mirrors from host X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Cc: Christian Hesse Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Christian Hesse Now that pacconf gives us all mirrors we can use them, instead of just the first one. Signed-off-by: Christian Hesse --- arch-nspawn.in | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/arch-nspawn.in b/arch-nspawn.in index b9c846e..661bbbd 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -60,17 +60,19 @@ fi pacconf_cmd=$(command -v pacman-conf || command -v pacconf) # shellcheck disable=2016 -host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#') +host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')) # shellcheck disable=2016 -[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g') # {{{ functions build_mount_args() { declare -g mount_args=() - if [[ -n $host_mirror_path ]]; then - mount_args+=("--bind-ro=$host_mirror_path") - fi + for host_mirror in "${host_mirrors[@]}"; do + if [[ $host_mirror == *file://* ]]; then + host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g') + mount_args+=("--bind-ro=$host_mirror_path") + fi + done mount_args+=("--bind=${cache_dirs[0]}") @@ -81,7 +83,10 @@ build_mount_args() { copy_hostconf () { cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d" - echo "Server = $host_mirror" >"$working_dir/etc/pacman.d/mirrorlist" + + for host_mirror in "${host_mirrors[@]}"; do + echo "Server = $host_mirror" + done >"$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"