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 ms0.migadu.com with LMTPS id KJNeCbKa42D3KgAAgWs5BA (envelope-from ) for ; Tue, 06 Jul 2021 01:50:10 +0200 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 KOQqBbKa42CeLwAA1q6Kng (envelope-from ) for ; Mon, 05 Jul 2021 23:50:10 +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 6678C182BB for ; Tue, 6 Jul 2021 01:50:09 +0200 (CEST) Received: from localhost ([::1]:47908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0YLo-0003sX-Dm for larch@yhetil.org; Mon, 05 Jul 2021 19:50:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0YLi-0003rE-Sp for guix-patches@gnu.org; Mon, 05 Jul 2021 19:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0YLi-0005JJ-LQ for guix-patches@gnu.org; Mon, 05 Jul 2021 19:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m0YLi-0004Sr-KP for guix-patches@gnu.org; Mon, 05 Jul 2021 19:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49425] [PATCH] guix-install.sh: Prompt for configuring substitutes discovery. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 05 Jul 2021 23:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49425 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49425@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162552896217107 (code B ref -1); Mon, 05 Jul 2021 23:50:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Jul 2021 23:49:22 +0000 Received: from localhost ([127.0.0.1]:46850 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0YL0-0004Rm-6J for submit@debbugs.gnu.org; Mon, 05 Jul 2021 19:49:22 -0400 Received: from lists.gnu.org ([209.51.188.17]:60958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m0YKv-0004RY-NK for submit@debbugs.gnu.org; Mon, 05 Jul 2021 19:49:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0YKv-00026c-DL for guix-patches@gnu.org; Mon, 05 Jul 2021 19:49:13 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]:45727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0YKp-0004jf-84 for guix-patches@gnu.org; Mon, 05 Jul 2021 19:49:13 -0400 Received: by mail-qt1-x82d.google.com with SMTP id c13so13243678qtb.12 for ; Mon, 05 Jul 2021 16:49:06 -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:mime-version :content-transfer-encoding; bh=A9lLBtoD/fl1kKkzDha0b1VqZc2cYmouoKR10LaWdaM=; b=OEu8xmrVQ4rGq52wYNcOWLtOk35k800MBGwyEe3g6622KORmex0c4Rec9bkMiM/Ro1 zNXWRmRQcZISUtLK40kC5m3Y0c4THKrLZ2Aj0YrO+eLfMNt0XjuUOc+fOxM8i1f4XvS6 hoele+mbNObVgZSLNmhugb+5MRse4p/vzYd7aYstfFhDBL1vOg5mwLIA6CYbmLSs8hva 8pc6hLt3a3UFyLRgAUGuULP9sG25swWSbg2rXL65znmaCzFRkZaGWvsLkmmDIKs89mGW ShJesK5ZMiga/eOKGuDiEEvGNepA/rp76q5qTVrOkv2p6Z1+NCVBOLLDFOknW68w7BnZ TdRQ== 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:mime-version :content-transfer-encoding; bh=A9lLBtoD/fl1kKkzDha0b1VqZc2cYmouoKR10LaWdaM=; b=fbD+oO2vwHJC4g8UeUdOsdoJ+uuwyV3qENF429HuPi6WyhkvB0uQCOi/Qnu0p9UHsE AkQ1DFaOj9CVZWIOpUgLxhIP+O0tTjNmXrKKkRGZIc2IG/WKK98FQ91uYkua/Ae09wus 7nwJhcXCRZkPo3nJsYOa/+/IMXNTPrzMEIzijyUF8GfvCveiFnxeBPzcrIaMlem+Vs9e m/aPJguX7ItapiUxplLtkbMB0aFZYccUlnnIaDiVAdnuOerorwQcSpJnSYdpFZEwFN1K PXGYIa87yuTM6iJOXsGZk4/O0Mk/yZzPS1t8FLUa921BFExCIUEwpeNI0CHDIycVW6OR eOnw== X-Gm-Message-State: AOAM531MYKfmQnLmHhG8pmVtrMxOqbJOu5WRTafAZyymLBeeeoz4OLov tjLFnd0Di1BOnwt0Ipv864E5qKN2KmnNZg== X-Google-Smtp-Source: ABdhPJx/UhKOdun7FI7+SbdaBN+lACOOA/rmlgwuUnix5cQIdBk+ibfuVgIEUy8uoyuF66BNwyucsg== X-Received: by 2002:ac8:608:: with SMTP id d8mr14774729qth.26.1625528945877; Mon, 05 Jul 2021 16:49:05 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-125-221.b2b2c.ca. [205.233.125.221]) by smtp.gmail.com with ESMTPSA id i10sm1694150qtx.80.2021.07.05.16.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 16:49:05 -0700 (PDT) From: Maxim Cournoyer Date: Mon, 5 Jul 2021 19:49:03 -0400 Message-Id: <20210705234903.21244-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::82d; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x82d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1625529009; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=A9lLBtoD/fl1kKkzDha0b1VqZc2cYmouoKR10LaWdaM=; b=Ip6nCit1EuDNOPG8BSu+jhxTJhp6ZmGgvxAH33RH7g67RHaZqcvT4IzSYu34PF4WO43iVS QuGkFb7ZGaz1jSq+SoO5wbWLxjPVShr0nuEC76REKDsv8XAEMs+miQNUqGLXdf+yngBw1f WbE4mdoY6AHEt7cbi9czNju9eX8WLRLtnNu4s/Kmw27YF463LJNaRBf15vRssqRIR27X3I +GYIWyOS4VvI50HAKwUPIdry3rVxGRysg1TI6/+vBMS0KUwiPiTR0SdTPzYS6BdQzezbq7 lBHJi6bpjE/ZyWfaXLj3mid2lXKwHRB/jzTJ4+GqdOrDrjGS2BE2rZkocxHiww== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1625529009; a=rsa-sha256; cv=none; b=QcF8ySlwQ8MlAeiwIumUoIzslX2bV9CD40JJScg5P1mQ9XhNuua3C3cmh7hllALlEMXLEM Qecwj2juD65b634F0L/K7/SRXfcUB1ewi1TslllWIIEh7HhZsV+ylSk/whmrdRYWXIYXWp yXA0TNq5PKZlcSVwSm/Smfupq04P0l8kbzyLfmYRCyibLxJUbuCjlVwEToU0SLcwTsL57W JWyj5YzMVtq9K0+VdRq5jqZ+q8q1RXfDle4iw4Q/k2HoTL/Y+i/yKjJd5FSpO2m9X+WNIB YHUAGl0/hrZMu6BYsdGK5wA3TwUdbH/gVbmhfyZ4u6OXTwQJk+x4m48j0W0w5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=OEu8xmrV; 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-Migadu-Spam-Score: 2.69 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=OEu8xmrV; 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-Migadu-Queue-Id: 6678C182BB X-Spam-Score: 2.69 X-Migadu-Scanner: scn1.migadu.com X-TUID: I74VJntSj7B6 Also ensure prompt_yes_no always print the message with a trailing space, which is more pleasing to the eye. * etc/guix-daemon.conf.in <--discovery=no>: New guix-daemon option. * etc/guix-daemon.service.in: Likewise. * etc/init.d/guix-daemon.in: Likewise. * etc/openrc/guix-daemon.in: Likewise. * etc/guix-install.sh (configure_substitute_discovery): New procedure. (sys_enable_guix_daemon): Ask the user whether automatic substitute discovery should be enabled. Set the '--discovery' argument accordingly. (prompt_yes_no): Add a trailing space to the message. (sys_authorize_build_farms): Remove trailing space from the message argument. * NEWS (Distribution): Add news. --- NEWS | 4 +++- etc/guix-daemon.conf.in | 2 +- etc/guix-daemon.service.in | 3 ++- etc/guix-install.sh | 22 ++++++++++++++++++++-- etc/init.d/guix-daemon.in | 2 +- etc/openrc/guix-daemon.in | 2 +- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index b0647b3700..ad9433a921 100644 --- a/NEWS +++ b/NEWS @@ -14,7 +14,9 @@ Please send Guix bug reports to bug-guix@gnu.org. * Changes in 1.4.0 (since 1.3.0) ** Package management - * New 'deb' format for the 'guix pack' command +*** New 'deb' format for the 'guix pack' command +** Distribution +*** The installation script can now configure substitute discovery * Changes in 1.3.0 (since 1.2.0) ** Package management diff --git a/etc/guix-daemon.conf.in b/etc/guix-daemon.conf.in index 755192d555..b122ca8c7a 100644 --- a/etc/guix-daemon.conf.in +++ b/etc/guix-daemon.conf.in @@ -7,4 +7,4 @@ start on runlevel [2345] stop on runlevel [016] -exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild +exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild --discovery=no diff --git a/etc/guix-daemon.service.in b/etc/guix-daemon.service.in index 407cdd199c..17b54eaeb0 100644 --- a/etc/guix-daemon.service.in +++ b/etc/guix-daemon.service.in @@ -6,7 +6,8 @@ Description=Build daemon for GNU Guix [Service] -ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild +ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ + --build-users-group=guixbuild --discover=no Environment='GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8 RemainAfterExit=yes StandardOutput=syslog diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 6a799fa823..1e7702d4c5 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -96,7 +96,7 @@ _debug() # $1: The prompt question. prompt_yes_no() { while true; do - read -rp "$1" yn + read -rp "$1 " yn case $yn in [Yy]*) return 0;; [Nn]*) return 1;; @@ -249,6 +249,16 @@ chk_sys_nscd() fi } +# Configure substitute discovery according to user's preferences. +# $1 is the installed service file to edit. +configure_substitute_discovery() { +if grep -q -- '--discover=no' "$1" && \ + prompt_yes_no "Would you like to enable automatic substitute \ +discovery? (yes/no)"; then + sed -i 's/--discover=no/--discover=yes/' "$1" +fi +} + # ------------------------------------------------------------------------------ #+MAIN @@ -397,6 +407,7 @@ sys_enable_guix_daemon() { initctl reload-configuration; cp "~root/.config/guix/current/lib/upstart/system/guix-daemon.conf" \ /etc/init/ && + configure_substitute_discovery /etc/init/guix-daemon.conf && start guix-daemon; } && _msg "${PAS}enabled Guix daemon via upstart" ;; @@ -426,6 +437,9 @@ sys_enable_guix_daemon() -e 's/^Environment=\(.*\)$/Environment=\1 LC_ALL=en_US.UTF-8'; fi; + configure_substitute_discovery \ + /etc/systemd/system/guix-daemon.service + systemctl daemon-reload && systemctl enable guix-daemon && systemctl start guix-daemon; } && @@ -437,6 +451,8 @@ sys_enable_guix_daemon() /etc/init.d/guix-daemon; chmod 775 /etc/init.d/guix-daemon; + configure_substitute_discovery /etc/init.d/guix-daemon + update-rc.d guix-daemon defaults && update-rc.d guix-daemon enable && service guix-daemon start; } && @@ -448,6 +464,8 @@ sys_enable_guix_daemon() /etc/init.d/guix-daemon; chmod 775 /etc/init.d/guix-daemon; + configure_substitute_discovery /etc/init.d/guix-daemon + rc-update add guix-daemon default && rc-service guix-daemon start; } && _msg "${PAS}enabled Guix daemon via OpenRC" @@ -472,7 +490,7 @@ sys_enable_guix_daemon() sys_authorize_build_farms() { # authorize the public key of the build farm if prompt_yes_no "Permit downloading pre-built package binaries from the \ -project's build farm? (yes/no) "; then +project's build farm? (yes/no)"; then guix archive --authorize \ < "~root/.config/guix/current/share/guix/ci.guix.gnu.org.pub" \ && _msg "${PAS}Authorized public key for ci.guix.gnu.org" diff --git a/etc/init.d/guix-daemon.in b/etc/init.d/guix-daemon.in index 1cc49fed89..b7d4bb72bb 100644 --- a/etc/init.d/guix-daemon.in +++ b/etc/init.d/guix-daemon.in @@ -36,7 +36,7 @@ start) -E LC_ALL=en_US.utf8 \ -p "/var/run/guix-daemon.pid" \ @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ - --build-users-group=guixbuild + --build-users-group=guixbuild --discover=no fi ;; stop) diff --git a/etc/openrc/guix-daemon.in b/etc/openrc/guix-daemon.in index 110a58b88d..eeedc2a840 100644 --- a/etc/openrc/guix-daemon.in +++ b/etc/openrc/guix-daemon.in @@ -20,7 +20,7 @@ export GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale export LC_ALL=en_US.utf8 command="@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon" -command_args="--build-users-group=guixbuild" +command_args="--build-users-group=guixbuild --discover=no" command_background="yes" pidfile="/var/run/guix-daemon.pid" -- 2.32.0