From patchwork Fri Mar 22 11:21:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Hesse X-Patchwork-Id: 1046 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 1D428CA9CE25 for ; Fri, 22 Mar 2019 11:21:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on apollo X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00=-1,DKIM_INVALID=1, DKIM_SIGNED=0.1,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Fri, 22 Mar 2019 11:21:53 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id D9FF1116417425; Fri, 22 Mar 2019 11:21:51 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Fri, 22 Mar 2019 11:21:51 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id A677A2C486; Fri, 22 Mar 2019 11:21:51 +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=kq+O4Ji5 Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 45A062C46F for ; Fri, 22 Mar 2019 11:21:48 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Fri, 22 Mar 2019 11:21:48 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id F3981116417417 for ; Fri, 22 Mar 2019 11:21:42 +0000 (UTC) Received: from mx.mylinuxtime.de (mx.mylinuxtime.de [195.201.174.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Fri, 22 Mar 2019 11:21:42 +0000 (UTC) Received: from leda.eworm.de (unknown [87.190.244.126]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mx.mylinuxtime.de (Postfix) with ESMTPSA id E329113F4D3; Fri, 22 Mar 2019 12:21:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 mx.mylinuxtime.de E329113F4D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eworm.de; s=mail; t=1553253702; bh=D/avsdSorBishScdTxrHgYP53+5evmCXorW1Dlxv3FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kq+O4Ji55YYz5v7HademxqfG1A2hHKV4N7gL4Wanu8dBwiOVjVSywoCFZ0xNlAcH1 F7x8xK0ifC5SBqW6Gi2UsmwmheSgRumrdbd+BZ648ctye1DMiZExgOK7C9GxExzAcm rJW9SdEolMz6qGwoNu2s9LzgnjaY37HtLZ1TFuvw= Received: by leda.eworm.de (Postfix, from userid 1000) id 744A2120384; Fri, 22 Mar 2019 12:21:11 +0100 (CET) From: Christian Hesse To: arch-projects@archlinux.org Date: Fri, 22 Mar 2019 12:21:08 +0100 Message-Id: <20190322112108.8861-1-list@eworm.de> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20180731182530.11870-1-list@eworm.de> References: <20180731182530.11870-1-list@eworm.de> MIME-Version: 1.0 X-Spamd-Bar: ++++++++++ X-Rspamd-Queue-Id: E329113F4D3 Authentication-Results: mx.mylinuxtime.de; auth=pass smtp.auth=smtp-only@eworm.de smtp.mailfrom=eworm@leda.eworm.de X-Rspamd-Server: mx X-Stat-Signature: qgoc4rgyj4gjkingj7oamxpdrmm1xqan X-Spamd-Result: default: False [10.43 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_SPAM(4.84)[99.34%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM(0.39)[0.130,0]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; FORGED_SENDER(0.30)[list@eworm.de,eworm@leda.eworm.de]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:3320, ipnet:87.128.0.0/10, country:DE]; FROM_NEQ_ENVFROM(0.00)[list@eworm.de,eworm@leda.eworm.de]; RCVD_COUNT_TWO(0.00)[2] X-Spam: Yes 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.29 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch-nspawn.in b/arch-nspawn.in index b9c846e..e68e2e7 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,7 @@ 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" + printf 'Server = %s\n' "${host_mirrors[@]}" >"$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"