From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id cNjiEKN5VmaccgEAqHPOHw:P1 (envelope-from ) for ; Wed, 29 May 2024 02:41:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id cNjiEKN5VmaccgEAqHPOHw (envelope-from ) for ; Wed, 29 May 2024 02:41:07 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=VYkqgFiN; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716943267; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=adtg+/5L37hM9gKpgEtpBRcxQHEC4z32jcRTiIy13xY=; b=AT0DXIJPocHfsu9uSpiAt/17X1PGB7LHbWPhKIvky1MC17hiKN/Hwe160SmYKeOFDTiK0A A2F/etREesV1mXU61CFD2fdDoA9aWBwrqyyHtIGMBl6sKwA61UsrWGw0LN9mRUY5AQjSV+ IWWTEHs6qkoWMguX3562/W9oeNvT9qmIqd6eT1LpJ1mnbK/m0Ju+PNklFDn/LxtGuXH1As N+gkqojIN1tRnfLGLwBPiCRSYVMu+Jxi/B3Xvzi36DWu3jPjw/FMhrmP8LQbe4tq6kRbU4 zBakkgem6iLnqbRtjbqExAGDCgIHvpaP/xTBwT2kECQrPWZUi75e8LPFaFz+qg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=VYkqgFiN; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716943267; a=rsa-sha256; cv=none; b=Y7rSzkmSwNKpNFRYVOOC+xEQwEkOqSFWy6wTt1sSwyz6acizokMTkJISC9aj0B7XDqoVX3 X3cbwDtKO5E9OQKhVhy2mQWVIUYb/8b6lrpE8/0pNj7rtOdCJ4IS/m8kL83/pu8AtvDK+z b+Y4htybffiXb3usNvhpEBfgaByjWDQYaKqIPrnHJ06eg9wL7YQH5iKx2FiFNnndQrPPGT Zt9k/S8VKIaxWpBnN1n4I43ASU1ucQdfH6tPH2RA/yG72AZHhFaYavEQVbW0B7gERIezV5 Xk6dMVsc1Q8p24CbYQbHuhUXtkgwO5DkRon1YCvnq6nKEX7VOqAo1Bkhg3wk8A== 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 BE3FB213E2 for ; Wed, 29 May 2024 02:41:03 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sC7N9-0003Vb-4j; Tue, 28 May 2024 20:40:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sC7N6-0003VL-W1 for guix-patches@gnu.org; Tue, 28 May 2024 20:40:53 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sC7N6-0003GJ-OI for guix-patches@gnu.org; Tue, 28 May 2024 20:40:52 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sC7NG-0004Sf-54 for guix-patches@gnu.org; Tue, 28 May 2024 20:41:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70148] [PATCH v2] guix-install.sh: Add unique requirement for sysv init system References: <4e4fa72cfff690365f06c94534bc3d03ac7a3418.1712074456.git.richard@freakingpenguin.com> In-Reply-To: <4e4fa72cfff690365f06c94534bc3d03ac7a3418.1712074456.git.richard@freakingpenguin.com> Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 29 May 2024 00:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70148 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70148@debbugs.gnu.org Cc: ludo@gnu.org, Richard Sent , zimon.toutoune@gmail.com Received: via spool by 70148-submit@debbugs.gnu.org id=B70148.171694325917132 (code B ref 70148); Wed, 29 May 2024 00:41:02 +0000 Received: (at 70148) by debbugs.gnu.org; 29 May 2024 00:40:59 +0000 Received: from localhost ([127.0.0.1]:37020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sC7ND-0004SG-2w for submit@debbugs.gnu.org; Tue, 28 May 2024 20:40:59 -0400 Received: from mail-108-mta207.mxroute.com ([136.175.108.207]:43321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sC7N9-0004S3-W0 for 70148@debbugs.gnu.org; Tue, 28 May 2024 20:40:57 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta207.mxroute.com (ZoneMTA) with ESMTPSA id 18fc1cac8ea000efce.001 for <70148@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 29 May 2024 00:40:43 +0000 X-Zone-Loop: 909fca6bbb45f6bb059e33881bc8a80126fa072a689c X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=adtg+/5L37hM9gKpgEtpBRcxQHEC4z32jcRTiIy13xY=; b=VYkqgFiNJW1lTptUreLxETKuXl M16RYRhrH6/8vZRye356vZUlDzBnHuJFH5Bsjbyq17KmShkQov1JEOUbJT6NB8d4EZ0V3EiGlrrPg w22AIy90OS50D2hQFFWgzfLj61pgxWdP+j7jypbz8v4ygyXATY/jSgSUfFUxqdvoMjV3/Fnqyh7jb Teh0AdfXSkNq5QsULYObffZ4CakfQ2EuSf9RorD4NPE7wYl/3al6c34Y4Maa6Uzb5ZB3T2QQosTDi akNRphE5BWx7bJ2KC5h8p7HH38dKxEN5mPxqbHFoXnMlNLm9gXA2WW2BGs3p7x2hK5B42GPRH9+xr VRPQN0Nw==; From: Richard Sent Date: Tue, 28 May 2024 20:36:06 -0400 Message-ID: <4253a50c53caa41f468163c6f9f8730e86678f38.1716942966.git.richard@freakingpenguin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -3.85 X-Migadu-Queue-Id: BE3FB213E2 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -3.85 X-TUID: SH7fFB3Dkk+V 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 --- Hi all, Here's an updated patch that is more selective about only checking for dependencies when it's required. It might be a touch overengineered, but I felt this was a better solution compared to hardcoding a daemonize requirement check in chk_init_sys or similar. I wanted to avoid calling chk_require twice. Because chk_require outputs to the console, calling it multiple times will either a) print multiple "verification of blah blah blah" messages to the user or b) cause the user to fix the generic requirements, then need to fix init system specific requirements as a two step process. If it's ever relevant, this patch will make it quite easy to add additional checks for specific init systems. etc/guix-install.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 82accfd5d5..09a7ca3ae8 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -15,6 +15,7 @@ # Copyright © 2020 David A. Redick # Copyright © 2024 Janneke Nieuwenhuizen # Copyright © 2024 Tomas Volf <~@wolfsden.cz> +# Copyright © 2024 Richard Sent # # This file is part of GNU Guix. # @@ -81,6 +82,12 @@ REQUIRE=( "xz" ) +# Add variables using form FOO_INIT_REQUIRE when init system FOO dependencies +# should be checked. +SYSV_INIT_REQUIRE=( + "daemonize" +) + PAS=$'[ \033[32;1mPASS\033[0m ] ' ERR=$'[ \033[31;1mFAIL\033[0m ] ' WAR=$'[ \033[33;1mWARN\033[0m ] ' @@ -148,6 +155,18 @@ chk_require() _msg "${PAS}verification of required commands completed" } +add_init_sys_require() +{ # Add the elements of FOO_INIT_SYS to REQUIRE + local init_require="${INIT_SYS}_REQUIRE[@]" + if [[ ! -z "$init_require" ]]; then + # Have to add piecemeal because ${!foo[@]} performs direct array key + # expansion, not indirect plain array expansion. + for r in "${!init_require}"; do + REQUIRE+=("$r") + done + fi +} + chk_gpg_keyring() { # Check whether the Guix release signing public key is present. _debug "--- [ ${FUNCNAME[0]} ] ---" @@ -793,9 +812,10 @@ main_install() _msg "Starting installation ($(date))" chk_term + chk_init_sys + add_init_sys_require chk_require "${REQUIRE[@]}" chk_gpg_keyring - chk_init_sys chk_sys_arch chk_sys_nscd base-commit: 542b18709a46e361de8f25e3fece29860532743c -- 2.41.0