From patchwork Wed Aug 7 15:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis 'GNUtoo' Carikli X-Patchwork-Id: 66871 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 72F7527BBEA; Wed, 7 Aug 2024 16:41:02 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E4DF627BBE2 for ; Wed, 7 Aug 2024 16:41:00 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbimG-0007XU-Vq; Wed, 07 Aug 2024 11:40:41 -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 1sbimE-0007X9-6E for guix-patches@gnu.org; Wed, 07 Aug 2024 11:40:38 -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 1sbimD-0006As-Sw for guix-patches@gnu.org; Wed, 07 Aug 2024 11:40:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=ftZu8O/qtDd1VbTGKcoN8Wiy96LjWd8GT7pIVDyRPxs=; b=ckqgn8nofIu72+hNXl9wRntvOVkNVmOLyCKE3C75+xB3O1W/TNnoUDmXnF+k27jo7Hdl+VIP1K7lLtmlFVjbprIJivRUO2ng6uFfWvEzKmIrdKBOVqapEha2Ad1qsaUJltLWPKqdWANkjnheFUQduEXCewnRpn/O+woKpl1Co5aPQIyg35hThJepwg2Ib1chH0/BHB0QHwO87MmhR7A/T61tn23QK67DvnbfgzNs9WyCKSeH47H8580qPDmmiV5dIb3PKMA1aPkFn6bzHUfJov5SWBkEVpf9IvFT03SvC/jMP5w3tSLGzbh3TCPsQaqM1w0ELafPgt63D64nQtTnLw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sbimd-0002Yu-41 for guix-patches@gnu.org; Wed, 07 Aug 2024 11:41:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72514] [PATCH v1 2/2] guix-install.sh: Support perp. Resent-From: Denis 'GNUtoo' Carikli Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Wed, 07 Aug 2024 15:41:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72514 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72514@debbugs.gnu.org, =?utf-8?q?Mat=C3=ADas?= Fonzo Cc: Denis 'GNUtoo' Carikli , ( , Christopher Baines , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice , jgart X-Debbugs-Original-Xcc: ( , Christopher Baines , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice , jgart Received: via spool by 72514-submit@debbugs.gnu.org id=B72514.17230452189747 (code B ref 72514); Wed, 07 Aug 2024 15:41:03 +0000 Received: (at 72514) by debbugs.gnu.org; 7 Aug 2024 15:40:18 +0000 Received: from localhost ([127.0.0.1]:34948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbilu-0002X9-4J for submit@debbugs.gnu.org; Wed, 07 Aug 2024 11:40:18 -0400 Received: from cyberdimension.org ([79.143.250.36]:53774 helo=rockpro64.cyberdimension.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbilq-0002Wc-TH for 72514@debbugs.gnu.org; Wed, 07 Aug 2024 11:40:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=dkim; bh=JWykyVKxDT+F4GQ ULmDoN9nytmlcvXrRkgP4YwCftww=; h=references:in-reply-to:date:subject: cc:to:from; d=cyberdimension.org; b=GDtZGMcI/0Ggxr73mUtnMqdpdjap1Emixc BGb/VUUM3y9Cgt2zW2eVYV6qPVGN4j7vHtgwWlk7S5u5ppYNcYn3PnVwFrpB6sZdAcZvw6 X7TMeO7Q/dKum3660BrQYMHbKHFFigxdlVrgHAYMzYJUQjcVHHdlsj5diOIA2AssCGQOdi AkUIr+3nlvGlau5INjxgeL6OF6Rm5gqRsO5eZDYZp1K3jP2/col8qCx6JgcGbEa7uWF0t0 4E1ze2KHEa2wY5YOWQhD9MckreyTFgT4ZUWviGd36mmySgkWslTsS5mRQyVhH2cjKuSN17 YLxcPuQqd2tQ9ETFH7+bxJqZ+W9w== Received: from localhost.localdomain (localhost [127.0.0.1]) by rockpro64.cyberdimension.org (OpenSMTPD) with ESMTP id fc83aafb; Wed, 7 Aug 2024 15:39:46 +0000 (UTC) From: Denis 'GNUtoo' Carikli Date: Wed, 7 Aug 2024 17:39:19 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Without this patch, it is possible to install Guix on Dragora, but then no init system is detected and so the Guix daemon isn't started. Thanks a lot for the help from selk on #dragora on Libera Chat for the help. * etc/guix-install.sh (chk_init_sys): Detect perp. (sys_enable_guix_daemon): Install, configure, enable and start the perp service. (sys_delete_guix_daemon): Stop and remove the perp service. * etc/perp/rc.log.in: New file. * etc/perp/rc.main.in: New file. * nix/local.mk: Add build rules. * .gitignore: Ignore generated etc/perp/rc.log and etc/perp/rc.main. Change-Id: I15a5229fee69ebd41ac538b25a3e68793c563144 Signed-off-by: Denis 'GNUtoo' Carikli --- .gitignore | 2 ++ etc/guix-install.sh | 25 +++++++++++++++++++++++++ etc/perp/rc.log.in | 24 ++++++++++++++++++++++++ etc/perp/rc.main.in | 45 +++++++++++++++++++++++++++++++++++++++++++++ nix/local.mk | 17 ++++++++++++++++- 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 etc/perp/rc.log.in create mode 100644 etc/perp/rc.main.in diff --git a/.gitignore b/.gitignore index 0f74b5da3d..11f99e32db 100644 --- a/.gitignore +++ b/.gitignore @@ -77,6 +77,8 @@ /etc/guix-gc.service /etc/init.d/guix-daemon /etc/openrc/guix-daemon +/etc/perp/rc.log +/etc/perp/rc.main /guix-* /guix/config.scm /libformat.a diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 9d9c294d75..4a0b326ffa 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -232,6 +232,10 @@ chk_init_sys() _msg "${INF}init system is: systemd" INIT_SYS="systemd" return 0 + elif [[ $(perpboot -V 2>&1) =~ perpboot ]]; then + _msg "${INF}init system is: perp" + INIT_SYS="perp" + return 0 elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then _msg "${INF}init system is: sysv-init" INIT_SYS="sysv-init" @@ -505,6 +509,20 @@ sys_enable_guix_daemon() systemctl start guix-daemon; } && _msg "${PAS}enabled Guix daemon via systemd" ;; + perp) + { mkdir -p /etc/perp/guix-daemon/; + cp ~root/.config/guix/current/etc/perp/rc.log \ + /etc/perp/guix-daemon/rc.log; + cp ~root/.config/guix/current/etc/perp/rc.main \ + /etc/perp/guix-daemon/rc.main; + chmod 775 /etc/perp/guix-daemon/rc.log; + chmod 775 /etc/perp/guix-daemon/rc.main; + + configure_substitute_discovery /etc/perp/guix-daemon/rc.main + + perpctl A guix-daemon; } && + _msg "${PAS}enabled Guix daemon via perp" + ;; sysv-init) { mkdir -p /etc/init.d; cp ~root/.config/guix/current/etc/init.d/guix-daemon \ @@ -587,6 +605,13 @@ sys_delete_guix_daemon() systemctl daemon-reload ;; + perp) + _msg "${INF}stopping and disabling guix-daemon" + perpctl X guix-daemon + _msg "${INF}removing guix-daemon" + rm -rf /etc/perp/guix-daemon + ;; + sysv-init) update-rc.d guix-daemon disable service guix-daemon stop diff --git a/etc/perp/rc.log.in b/etc/perp/rc.log.in new file mode 100644 index 0000000000..11c3ab490e --- /dev/null +++ b/etc/perp/rc.log.in @@ -0,0 +1,24 @@ +#!/bin/sh +# GNU Guix --- Functional package management for GNU +# Copyright © 2024 Denis 'GNUtoo' Carikli +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +if [ "${1}" = "start" ] ; then + exec tinylog_run "${2}" +fi + +exit 0 diff --git a/etc/perp/rc.main.in b/etc/perp/rc.main.in new file mode 100644 index 0000000000..cdf92763eb --- /dev/null +++ b/etc/perp/rc.main.in @@ -0,0 +1,45 @@ +#! /bin/sh +# GNU Guix --- Functional package management for GNU +# Copyright © 2024 Denis 'GNUtoo' Carikli +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +start() { + echo "*** ${SVNAME}: starting Guix daemon..." + + export GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale + export LC_ALL=en_US.utf8 + exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ + --build-users-group=guixbuild --discover=no \ + --substitute-urls='https://bordeaux.guix.gnu.org https://ci.guix.gnu.org' 2>&1 +} + +reset() { + case $3 in + "exit" ) + echo "*** ${SVNAME}: exited status $4" + ;; + "signal" ) + echo "*** ${SVNAME}: killed on signal $5" + ;; + * ) + echo "*** ${SVNAME}: stopped ($3)" + ;; + esac + exit 0 +} + +eval ${TARGET} "$@" diff --git a/nix/local.mk b/nix/local.mk index 8a2b2b88e8..ffc57185cf 100644 --- a/nix/local.mk +++ b/nix/local.mk @@ -194,6 +194,18 @@ etc/openrc/guix-daemon: etc/openrc/guix-daemon.in \ "$<" > "$@.tmp"; \ mv "$@.tmp" "$@" +# The service script for perp. +perpservicedir = $(sysconfdir)/perp +nodist_perpservice_DATA = etc/perp/rc.log etc/perp/rc.main + +etc/perp/rc.%: etc/perp/rc.%.in \ + $(top_builddir)/config.status + $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ + $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' \ + -e 's|@''GUIX_SUBSTITUTE_URLS''@|$(GUIX_SUBSTITUTE_URLS)|' \ + < "$<" > "$@.tmp"; \ + mv "$@.tmp" "$@" + # The '.conf' jobs for Upstart. upstartjobdir = $(libdir)/upstart/system nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf @@ -210,6 +222,7 @@ CLEANFILES += \ $(nodist_systemdservice_DATA) \ $(nodist_upstartjob_DATA) \ $(nodist_sysvinitservice_DATA) \ + $(nodist_perpservice_DATA) \ $(nodist_openrcservice_DATA) EXTRA_DIST += \ @@ -223,7 +236,9 @@ EXTRA_DIST += \ etc/guix-gc.service.in \ etc/guix-gc.timer \ etc/init.d/guix-daemon.in \ - etc/openrc/guix-daemon.in + etc/openrc/guix-daemon.in \ + etc/perp/rc.log.in \ + etc/perp/rc.main.in if CAN_RUN_TESTS