Subject: bug#67241: [PATCH] guix-install.sh: Add message about Info reader.

From: Simon Tournier <[email-masked]>
Date: Sat, 16 Nov 2024 08:54:07 +0100

* etc/guix-install.sh (_info): New procedure.
(_chk_sys_nscd, main_install): Use it.

Change-Id: I2cad8bc2554cd4ea88f30c8a104b7c62f2aa2e0e
---
 etc/guix-install.sh | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index f07b2741bb..08e25de238 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -5,7 +5,7 @@
 # Copyright © 2018 Efraim Flashner <[email-masked]>
 # Copyright © 2019–2020, 2022 Tobias Geerinckx-Rice <[email-masked]>
 # Copyright © 2020 Morgan Smith <[email-masked]>
-# Copyright © 2020 Simon Tournier <[email-masked]>
+# Copyright © 2020, 2024 Simon Tournier <[email-masked]>
 # Copyright © 2020 Daniel Brooks <[email-masked]>
 # Copyright © 2021 Jakub Kądziołka <[email-masked]>
 # Copyright © 2021 Chris Marusich <[email-masked]>
@@ -129,6 +129,16 @@ die()
     exit 1
 }
 
+_info()
+{
+    if [ "$(type -P info)" ]; then
+        _msg "$1"
+    else
+        _msg "${WAR}Please install Info reader; see package 'info-reader'"
+        _msg "$1"
+    fi
+}
+
 # Return true if user answered yes, false otherwise.  The prompt is
 # yes-biased, that is, when the user simply enter newline, it is equivalent to
 # answering "yes".
@@ -290,11 +300,11 @@ chk_sys_nscd()
     if [ "$(type -P pidof)" ]; then
         if [ ! "$(pidof nscd)" ]; then
             _msg "${WAR}We recommend installing and/or starting your distribution 'nscd' service"
-            _msg "${WAR}Please read 'info guix \"Application Setup\"' about \"Name Service Switch\""
+            _info "${WAR}Please read 'info guix \"Application Setup\"' about \"Name Service Switch\""
         fi
     else
         _msg "${INF}We cannot determine if your distribution 'nscd' service is running"
-        _msg "${INF}Please read 'info guix \"Application Setup\"' about \"Name Service Switch\""
+        _info "${INF}Please read 'info guix \"Application Setup\"' about \"Name Service Switch\""
     fi
 }
 
@@ -856,7 +866,7 @@ main_install()
     rm -r "${tmp_path}"
 
     _msg "${PAS}Guix has successfully been installed!"
-    _msg "${INF}Run 'info guix' to read the manual."
+    _info "${INF}Run 'info guix' to read the manual."
 
     # Required to source /etc/profile in desktop environments.
     _msg "${INF}Please log out and back in to complete the installation."

base-commit: 3e8d3d80f41e016cdfe80e488a78c2351c94fef8
-- 
2.45.2