[bug#33134,4/4] guix-install.sh: Update sys_authorize_build_farms.

Message ID 20181109041534.4489-1-s@ricketyspace.net
State Accepted
Headers show
Series Add auto yes/no switch to guix-install.sh | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied

Commit Message

rsiddharth Nov. 9, 2018, 4:15 a.m. UTC
* etc/guix-install.sh (sys_authorize_build_farms): Don't prompt
if AUTO_YN is set.
---
 etc/guix-install.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 16686ff89..cbcf5316d 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -355,8 +355,11 @@  sys_enable_guix_daemon()
 
 sys_authorize_build_farms()
 { # authorize the public keys of the two build farms
+    local yn=$AUTO_YN
+
     while true; do
-        read -p "Permit downloading pre-built package binaries from the project's build farms? (yes/no) " yn
+        [[ -n $yn ]] || read -p "Permit downloading pre-built package binaries from the project's build farms? (yes/no) " yn
+
         case $yn in
             [Yy]*) guix archive --authorize < "${ROOT_HOME}/.guix-profile/share/guix/hydra.gnu.org.pub" &&
                          _msg "${PAS}Authorized public key for hydra.gnu.org";
@@ -365,7 +368,7 @@  sys_authorize_build_farms()
                    break;;
             [Nn]*) _msg "${INF}Skipped authorizing build farm public keys"
                    break;;
-            *) _msg "Please answer yes or no.";
+            *) _msg "Please answer yes or no."; yn=""
         esac
     done
 }