From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EOrtHElywV41DAAA0tVLHw (envelope-from ) for ; Sun, 17 May 2020 17:20:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CJ/vGElywV45fAAA1q6Kng (envelope-from ) for ; Sun, 17 May 2020 17:20:09 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 18D3A940429 for ; Sun, 17 May 2020 17:20:09 +0000 (UTC) Received: from localhost ([::1]:44796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaMxM-0001aQ-2r for larch@yhetil.org; Sun, 17 May 2020 13:20:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaMwR-0008NL-BS for guix-patches@gnu.org; Sun, 17 May 2020 13:19:11 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33090) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaMwR-0004NQ-1k for guix-patches@gnu.org; Sun, 17 May 2020 13:19:11 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jaMwQ-0007BA-Th for guix-patches@gnu.org; Sun, 17 May 2020 13:19:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40601] [PATCH 16/28] non-interactive mode, usage Resent-From: Vincent Legoll Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 17 May 2020 17:19:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40601 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40601@debbugs.gnu.org Cc: Vincent Legoll Received: via spool by 40601-submit@debbugs.gnu.org id=B40601.158973591927410 (code B ref 40601); Sun, 17 May 2020 17:19:10 +0000 Received: (at 40601) by debbugs.gnu.org; 17 May 2020 17:18:39 +0000 Received: from localhost ([127.0.0.1]:44606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaMvr-00077r-JN for submit@debbugs.gnu.org; Sun, 17 May 2020 13:18:39 -0400 Received: from mail-wr1-f46.google.com ([209.85.221.46]:35199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaMvJ-00072Y-PJ for 40601@debbugs.gnu.org; Sun, 17 May 2020 13:18:05 -0400 Received: by mail-wr1-f46.google.com with SMTP id j5so9128665wrq.2 for <40601@debbugs.gnu.org>; Sun, 17 May 2020 10:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hGqMRxJgM9E7ODx4XyXJlimNdJa81h/EIXwr4O4wHa0=; b=kn4uuBTsWCnlIMVYhMWnG9zUUMBaiyKghqnwoqvvDFciuJY4QRQAIrqt0RZh5+KaNE 519PGfBdwoANpMwOH5/0PYwM7GCNuiz34WCOTYcYC10KX2iketN+36DrlwyKUAAjvUCB fU/FoTTtnNGy6cd8vLKzKzXpa8Sf8RHnTBqp/GULnzN+g4yiSZ+1kGmV0/KkNOudOvF9 W7708Z1yRCqTjgyj38E6GrBj2VVvIj9Lz1JAT9gtOvmWqpFzZhX4Dp5lIUIoGVLLWyTS k5TczXUB3wzuf/Hk013Rc2QxdBehU6C1rW4foSa/Mg/F3aAfGHjYGlJhn/yKLSxBr6RT G1nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hGqMRxJgM9E7ODx4XyXJlimNdJa81h/EIXwr4O4wHa0=; b=Ju79RIkjXyXMqWOyELEYuqYtBq/qnrAb2ITKFH7gXMYjCfDPscXiK9gzS7uHSqIk66 Rt1oqwpST2JcuPn/GKb4k7f08o2o5ePd7Ql+GX0oDaIRFqXsg/QBD9w8zSNMwEtfs5al FnFqlAJG5H3HuQUuX+lIe8ayUPSjkIR+HZdt01fDGlKc2WGaHgTBpsBoVHoncJ/gFKgW IxEE2qGgcc1pbb1HR/SmNEb3QH6dEeT3WkVJGMuonM8oOowq9YHHiQl4xRwaN/OSA8XV eOWHPVFTS24sBzeTmmU3pqL4pzj9CuZ1Cgnj0xZKlDOutqDdnUZQ02PJcAykQBPEsn6N 3+bA== X-Gm-Message-State: AOAM532f6s5oSDe2RMWLkLfq4PM/ZJUoP+x4Df4NAyd6yuFAo51AH0UE NzlzkPviDfAqgnkjoWVqHl9lM4EI X-Google-Smtp-Source: ABdhPJx80GNLLXfvtmPypcGUdxVGp2ge4d4zqISqPOn2p/C/ppCy1Y8zg3/ddYRLRoBkSkIF64iQ+Q== X-Received: by 2002:a5d:40c2:: with SMTP id b2mr14624294wrq.13.1589735875983; Sun, 17 May 2020 10:17:55 -0700 (PDT) Received: from localhost.localdomain (se167-1-82-242-148-1.fbx.proxad.net. [82.242.148.1]) by smtp.gmail.com with ESMTPSA id v126sm13305048wma.9.2020.05.17.10.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 10:17:55 -0700 (PDT) From: Vincent Legoll Date: Sun, 17 May 2020 19:17:13 +0200 Message-Id: <20200517171725.732-16-vincent.legoll@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200517171725.732-1-vincent.legoll@gmail.com> References: <20200517171725.732-1-vincent.legoll@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=kn4uuBTs; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 4.09 X-TUID: HwX+SOcWBhBn --- etc/guix-install.sh | 68 +++++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 1c22ae95ee..7fb9332e97 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -48,7 +48,6 @@ REQUIRE=( "chmod" "uname" "tail" - "realpath" "tar" "xz" ) @@ -454,17 +453,23 @@ sys_make_guix_available() sys_authorize_build_farms() { # authorize the public key of the build farm - while true; do - read -p "Permit downloading pre-built package binaries from the project's build farm? (yes/no) " yn - case $yn in - [Yy]*) guix archive --authorize < "${ROOT_HOME}/.config/guix/current/share/guix/ci.guix.gnu.org.pub" && - _msg "${PAS}Authorized public key for ci.guix.gnu.org"; - break;; - [Nn]*) _msg "${INF}Skipped authorizing build farm public keys" - break;; - *) _msg "Please answer yes or no."; - esac - done + _AUTHORIZE_BUILD_FARM=1 + if [ "$1" -eq 1 ]; then + while true; do + read -p "Permit downloading pre-built package binaries from the project's build farm? (yes/no) " yn + case "$yn" in + [Yy]*) _AUTHORIZE_BUILD_FARM=1; break;; + [Nn]*) _AUTHORIZE_BUILD_FARM=0; break;; + *) _msg "Please answer yes or no.";; + esac + done + fi + if [ "$_AUTHORIZE_BUILD_FARM" -eq 1 ]; then + guix archive --authorize < "${ROOT_HOME}/.config/guix/current/share/guix/ci.guix.gnu.org.pub" && + _msg "${PAS}Authorized public key for ci.guix.gnu.org"; + else + _msg "${INF}Skipped authorizing build farm public keys" + fi } sys_create_init_profile() @@ -526,10 +531,41 @@ EOF read -r ANSWER } +# Do not change the tabs in the HERE-DOCUMENT +usage() +{ + cat <<-EOF + $0: Wrong arguments: + $0 [-h|--help] [-n|--non-interactive] [LOCAL_GUIX_BIN_TARBALL] + + -h|--help Show this help + -n|--non-interactive Avoid asing interactive question, run unattended + automatically allow substitutes from guix build farm + + LOCAL_GUIX_BIN_TARBALL Use the given guix binary tarball file instead of + downloading latest released one +EOF +} + +handle_args() +{ + _INTERACTIVE=1 + while [ "$#" -gt 0 ]; do + case "$1" in + -h|--help) usage; exit 0;; + -n|--non-interactive) _INTERACTIVE=0; shift 1;; + + -*) echo "unknown option: $1" >&2; echo; usage; exit 1;; + *) TARBALL="$1"; shift 1;; + esac + done +} + main() { local tmp_path - welcome + handle_args "$@" + [ "${_INTERACTIVE}" -eq 1 ] && welcome _msg "Starting installation ($(date))" @@ -544,19 +580,17 @@ main() umask 0022 tmp_path="$(mktemp -t -d guix.XXXXXX)" - if [ -z "$1" ]; then + if [ -z "${TARBALL}" ]; then guix_get_bin_list "${GNU_URL}" guix_get_bin "${GNU_URL}" "${BIN_VER}" "${tmp_path}" TARBALL="${BIN_VER}.tar.xz" - else - TARBALL="$(realpath $1)" fi sys_create_store "${TARBALL}" "${tmp_path}" sys_create_build_group sys_create_build_user sys_enable_guix_daemon sys_make_guix_available - sys_authorize_build_farms + sys_authorize_build_farms "${_INTERACTIVE}" sys_create_init_profile _msg "${INF}cleaning up ${tmp_path}" -- 2.26.2