unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements.
@ 2024-04-02 16:14 Richard Sent
  2024-05-04 16:49 ` Ludovic Courtès
  2024-05-29  0:36 ` [bug#70148] [PATCH v2] guix-install.sh: Add unique requirement for sysv init system Richard Sent
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Sent @ 2024-04-02 16:14 UTC (permalink / raw)
  To: 70148; +Cc: Richard Sent

* etc/guix-install.sh (REQUIRE): Add daemonize to requirements list.
Needed to spawn the Guix Daemon in guix-daemon.in

Change-Id: I77c7f2bdd686bb023ecfa108a499c2eafbad1eb7
---

Hi Guix. I noticed that in Debian WSL the guix daemon sysvinit service
wouldn't start due to daemonize not being present. This patch should
catch that issue sooner.

Both openrc and sysvinit use guix-daemon.in so daemonize should be
required regardless of the init system.

 etc/guix-install.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 982fb0a266..94ecb1d8f3 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -56,6 +56,7 @@ set -eo pipefail
 [ "$UID" -eq 0 ] || { echo "This script must be run as root."; exit 1; }
 
 REQUIRE=(
+    "daemonize"
     "dirname"
     "readlink"
     "wget"

base-commit: d67e4f0f9b10c7ddac8fb0ca68cbf1d6ad0a6e5d
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements.
  2024-04-02 16:14 [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements Richard Sent
@ 2024-05-04 16:49 ` Ludovic Courtès
  2024-05-04 22:44   ` Richard Sent
  2024-05-29  0:36 ` [bug#70148] [PATCH v2] guix-install.sh: Add unique requirement for sysv init system Richard Sent
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2024-05-04 16:49 UTC (permalink / raw)
  To: Richard Sent; +Cc: 70148

Hi Richard,

Richard Sent <richard@freakingpenguin.com> skribis:

> * etc/guix-install.sh (REQUIRE): Add daemonize to requirements list.
> Needed to spawn the Guix Daemon in guix-daemon.in
>
> Change-Id: I77c7f2bdd686bb023ecfa108a499c2eafbad1eb7
> ---
>
> Hi Guix. I noticed that in Debian WSL the guix daemon sysvinit service
> wouldn't start due to daemonize not being present. This patch should
> catch that issue sooner.
>
> Both openrc and sysvinit use guix-daemon.in so daemonize should be
> required regardless of the init system.

‘daemonize’ seems to be used by etc/init.d/guix-daemon.in, but not by
etc/openrc/guix-daemon.in, right?

>  REQUIRE=(
> +    "daemonize"

My only concern is if the majority of users (which I assume use systemd)
would get an error for a missing package they don’t actually need.

Do you think that is a risk or is ‘daemonize’ usually installed “by
default” even on those systemd distros?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements.
  2024-05-04 16:49 ` Ludovic Courtès
@ 2024-05-04 22:44   ` Richard Sent
  2024-05-22 14:08     ` Simon Tournier
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Sent @ 2024-05-04 22:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 70148

Hi Ludo!

>> Both openrc and sysvinit use guix-daemon.in so daemonize should be
>> required regardless of the init system.
>
> ‘daemonize’ seems to be used by etc/init.d/guix-daemon.in, but not by
> etc/openrc/guix-daemon.in, right?

Correct, I think I got confused by guix-install.sh copying
etc/openrc/guix-daemon to /etc/init.d/guix-daemon. (See the openrc
handler in the $INIT_SYS case statement in sys_enable_guix_daemon()).
Assuming I understand the script; I find shell scripts hard to parse.

> My only concern is if the majority of users (which I assume use systemd)
> would get an error for a missing package they don’t actually need.
>
> Do you think that is a risk or is ‘daemonize’ usually installed “by
> default” even on those systemd distros?

I suspect there's a risk. WSL Debian does not come with daemonize out of
the box so I imagine normal Debian does not either.

If OpenRC/systemd does not require daemonize, there's probably a better way to
handle this. Perhaps a INITD_REQUIRE variable that's only checked
conditionally depending on what init system is detected (aka INIT_SYS).

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements.
  2024-05-04 22:44   ` Richard Sent
@ 2024-05-22 14:08     ` Simon Tournier
  2024-05-25 13:59       ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Tournier @ 2024-05-22 14:08 UTC (permalink / raw)
  To: Richard Sent, Ludovic Courtès; +Cc: 70148

Hi,

On sam., 04 mai 2024 at 18:44, Richard Sent <richard@freakingpenguin.com> wrote:

> If OpenRC/systemd does not require daemonize, there's probably a better way to
> handle this. Perhaps a INITD_REQUIRE variable that's only checked
> conditionally depending on what init system is detected (aka INIT_SYS).

This appears to me the best solution.  It seems better that the
requirements stay as minimal as possible for most of users.

Well, maybe another variable as INITD_REQUIRE.  Or maybe a plain test
for this daemonize when the init system is detected; since for now there
is only one extra package, if I read correctly.

Cheers,
simon




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements.
  2024-05-22 14:08     ` Simon Tournier
@ 2024-05-25 13:59       ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2024-05-25 13:59 UTC (permalink / raw)
  To: Simon Tournier; +Cc: Richard Sent, 70148

Hi,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

> On sam., 04 mai 2024 at 18:44, Richard Sent <richard@freakingpenguin.com> wrote:
>
>> If OpenRC/systemd does not require daemonize, there's probably a better way to
>> handle this. Perhaps a INITD_REQUIRE variable that's only checked
>> conditionally depending on what init system is detected (aka INIT_SYS).
>
> This appears to me the best solution.  It seems better that the
> requirements stay as minimal as possible for most of users.

+1.  Would be best to ensure the installer doesn’t get in the way of
those using systemd distros.

Could you look into it, Richard?

Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#70148] [PATCH v2] guix-install.sh: Add unique requirement for sysv init system
  2024-04-02 16:14 [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements Richard Sent
  2024-05-04 16:49 ` Ludovic Courtès
@ 2024-05-29  0:36 ` Richard Sent
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Sent @ 2024-05-29  0:36 UTC (permalink / raw)
  To: 70148; +Cc: ludo, Richard Sent, zimon.toutoune

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 <david.a.redick@gmail.com>
 # Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 # Copyright © 2024 Tomas Volf <~@wolfsden.cz>
+# Copyright © 2024 Richard Sent <richard@freakingpenguin.com>
 #
 # 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-29  0:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-02 16:14 [bug#70148] [PATCH] guix-install.sh: Add daemonize to requirements Richard Sent
2024-05-04 16:49 ` Ludovic Courtès
2024-05-04 22:44   ` Richard Sent
2024-05-22 14:08     ` Simon Tournier
2024-05-25 13:59       ` Ludovic Courtès
2024-05-29  0:36 ` [bug#70148] [PATCH v2] guix-install.sh: Add unique requirement for sysv init system Richard Sent

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).