summaryrefslogtreecommitdiff
path: root/etc/guix-install.sh
diff options
context:
space:
mode:
authorRichard Sent <richard@freakingpenguin.com>2024-05-28 20:36:06 -0400
committerLudovic Courtès <ludo@gnu.org>2024-06-04 12:08:34 +0200
commit40c6f708393885a2d28f847350e8f47beb11e745 (patch)
treeed8a7bc80c01d9642a75e979502b42db6354a32b /etc/guix-install.sh
parent3e87b207ce96679e2f289a5522a248d38c4f3962 (diff)
guix-install.sh: Add unique requirement for sysv init system
This improves the installer's ability to detect that all requirements are present regardless of init system. It also avoids performing the requirement check twice (printing excessively to the console) and provides a framework for adding new init system specific requirements if it's needed in the future. * etc/guix-install.sh (add_init_sys_require): Create. (SYSV_INIT_REQUIRE): Create. (main_install): Reorder installer steps so all requirements are checked in one pass. Change-Id: Ic541c1b90499d504642b7ab4ae595501b1a37b0d Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'etc/guix-install.sh')
-rwxr-xr-xetc/guix-install.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index d61e36ef9b4..9d9c294d75e 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -15,6 +15,7 @@
15# Copyright © 2020 David A. Redick <david.a.redick@gmail.com> 15# Copyright © 2020 David A. Redick <david.a.redick@gmail.com>
16# Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org> 16# Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
17# Copyright © 2024 Tomas Volf <~@wolfsden.cz> 17# Copyright © 2024 Tomas Volf <~@wolfsden.cz>
18# Copyright © 2024 Richard Sent <richard@freakingpenguin.com>
18# 19#
19# This file is part of GNU Guix. 20# This file is part of GNU Guix.
20# 21#
@@ -81,6 +82,12 @@ REQUIRE=(
81 "xz" 82 "xz"
82) 83)
83 84
85# Add variables using form FOO_INIT_REQUIRE when init system FOO dependencies
86# should be checked.
87SYSV_INIT_REQUIRE=(
88 "daemonize"
89)
90
84PAS=$'[ \033[32;1mPASS\033[0m ] ' 91PAS=$'[ \033[32;1mPASS\033[0m ] '
85ERR=$'[ \033[31;1mFAIL\033[0m ] ' 92ERR=$'[ \033[31;1mFAIL\033[0m ] '
86WAR=$'[ \033[33;1mWARN\033[0m ] ' 93WAR=$'[ \033[33;1mWARN\033[0m ] '
@@ -148,6 +155,18 @@ chk_require()
148 _msg "${PAS}verification of required commands completed" 155 _msg "${PAS}verification of required commands completed"
149} 156}
150 157
158add_init_sys_require()
159{ # Add the elements of FOO_INIT_SYS to REQUIRE
160 local init_require="${INIT_SYS}_REQUIRE[@]"
161 if [[ ! -z "$init_require" ]]; then
162 # Have to add piecemeal because ${!foo[@]} performs direct array key
163 # expansion, not indirect plain array expansion.
164 for r in "${!init_require}"; do
165 REQUIRE+=("$r")
166 done
167 fi
168}
169
151chk_gpg_keyring() 170chk_gpg_keyring()
152{ # Check whether the Guix release signing public key is present. 171{ # Check whether the Guix release signing public key is present.
153 _debug "--- [ ${FUNCNAME[0]} ] ---" 172 _debug "--- [ ${FUNCNAME[0]} ] ---"
@@ -794,9 +813,10 @@ main_install()
794 _msg "Starting installation ($(date))" 813 _msg "Starting installation ($(date))"
795 814
796 chk_term 815 chk_term
816 chk_init_sys
817 add_init_sys_require
797 chk_require "${REQUIRE[@]}" 818 chk_require "${REQUIRE[@]}"
798 chk_gpg_keyring 819 chk_gpg_keyring
799 chk_init_sys
800 chk_sys_arch 820 chk_sys_arch
801 chk_sys_nscd 821 chk_sys_nscd
802 822