From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UHbCCJb+2F6iPQAA0tVLHw (envelope-from ) for ; Thu, 04 Jun 2020 14:00:54 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AEduBJb+2F60KgAAB5/wlQ (envelope-from ) for ; Thu, 04 Jun 2020 14:00:54 +0000 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 C12C5941094 for ; Thu, 4 Jun 2020 14:00:29 +0000 (UTC) Received: from localhost ([::1]:42626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgqQ0-0001tV-PB for larch@yhetil.org; Thu, 04 Jun 2020 10:00:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgqPd-0001RB-SG for bug-guix@gnu.org; Thu, 04 Jun 2020 10:00:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35606) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgqPd-00026d-Hg for bug-guix@gnu.org; Thu, 04 Jun 2020 10:00:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jgqPd-0004Z9-Hi for bug-guix@gnu.org; Thu, 04 Jun 2020 10:00:05 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#41541: [PATCH 8/8] system: Add `hurd-activation'. Resent-From: "Jan (janneke) Nieuwenhuizen" Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 04 Jun 2020 14:00:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41541 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 41541@debbugs.gnu.org Received: via spool by 41541-submit@debbugs.gnu.org id=B41541.159127918017429 (code B ref 41541); Thu, 04 Jun 2020 14:00:05 +0000 Received: (at 41541) by debbugs.gnu.org; 4 Jun 2020 13:59:40 +0000 Received: from localhost ([127.0.0.1]:47143 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgqPE-0004Wx-5t for submit@debbugs.gnu.org; Thu, 04 Jun 2020 09:59:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgqP7-0004Vb-RU for 41541@debbugs.gnu.org; Thu, 04 Jun 2020 09:59:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33099) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgqP2-0001vj-HZ; Thu, 04 Jun 2020 09:59:28 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=43728 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1jgqP1-0000GG-NB; Thu, 04 Jun 2020 09:59:28 -0400 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 4 Jun 2020 15:59:14 +0200 Message-Id: <20200604135914.4499-9-janneke@gnu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200604135914.4499-1-janneke@gnu.org> References: <20200604135914.4499-1-janneke@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 3.99 X-TUID: w4+KpmcohMqL * gnu/build/activation.scm (boot-time-system): Add #:kernel-command-line parameter. * gnu/build/activation.scm (activate-current-system): Likewise, and pass it. Change optional system parameter to #:system. * gnu/system.scm (gnu/linux-activation-script): Rename from activation-script. (activation-script, hurd-activation-script): New procedure. --- gnu/build/activation.scm | 9 +++-- gnu/services.scm | 81 +++++++++++++++++++++++++++------------- 2 files changed, 60 insertions(+), 30 deletions(-) diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 30f5e87d5a..85ff8d8996 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -318,13 +318,14 @@ improvement." ;; a new system configuration and activate it, without rebooting. "/run/current-system") -(define (boot-time-system) +(define* (boot-time-system #:key (kernel-command-line linux-command-line)) "Return the '--system' argument passed on the kernel command line." - (find-long-option "--system" (linux-command-line))) + (find-long-option "--system" (kernel-command-line))) (define* (activate-current-system - #:optional (system (or (getenv "GUIX_NEW_SYSTEM") - (boot-time-system)))) + #:key (kernel-command-line linux-command-line) + (system (or (getenv "GUIX_NEW_SYSTEM") + (boot-time-system #:kernel-command-line kernel-command-line)))) "Atomically make SYSTEM the current system." ;; The 'GUIX_NEW_SYSTEM' environment variable is used as a way for 'guix ;; system reconfigure' to pass the file name of the new system. diff --git a/gnu/services.scm b/gnu/services.scm index 614956fbab..78f5d15f06 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -519,35 +519,64 @@ ACTIVATION-SCRIPT-TYPE." (define (activation-script gexps) "Return the system's activation script, which evaluates GEXPS." + (program-file "activate.scm" (if (hurd-target?) + (hurd-activation-script gexps) + (gnu/linux-activation-script gexps)))) + +(define (gnu/linux-activation-script gexps) + "Return a GNU/Linux system activation script, which evaluates GEXPS." + (define actions (map (cut program-file "activate-service.scm" <>) gexps)) - (program-file "activate.scm" - (with-imported-modules (source-module-closure - '((gnu build activation) - (guix build utils))) - #~(begin - (use-modules (gnu build activation) - (guix build utils)) - - ;; Make sure the user accounting database exists. If it - ;; does not exist, 'setutxent' does not create it and - ;; thus there is no accounting at all. - (close-port (open-file "/var/run/utmpx" "a0")) - - ;; Same for 'wtmp', which is populated by mingetty et - ;; al. - (mkdir-p "/var/log") - (close-port (open-file "/var/log/wtmp" "a0")) - - ;; Set up /run/current-system. Among other things this - ;; sets up locales, which the activation snippets - ;; executed below may expect. - (activate-current-system) - - ;; Run the services' activation snippets. - ;; TODO: Use 'load-compiled'. - (for-each primitive-load '#$actions))))) + (with-imported-modules (source-module-closure + '((gnu build activation) + (guix build utils))) + #~(begin + (use-modules (gnu build activation) + (guix build utils)) + + ;; Make sure the user accounting database exists. If it + ;; does not exist, 'setutxent' does not create it and + ;; thus there is no accounting at all. + (close-port (open-file "/var/run/utmpx" "a0")) + + ;; Same for 'wtmp', which is populated by mingetty et + ;; al. + (close-port (open-file "/var/log/wtmp" "a0")) + + ;; Set up /run/current-system. Among other things this + ;; sets up locales, which the activation snippets + ;; executed below may expect. + (activate-current-system) + + ;; Run the services' activation snippets. + ;; TODO: Use 'load-compiled'. + (for-each primitive-load '#$actions)))) + +(define (hurd-activation-script gexps) + "Return the Hurd activation script, which evaluates GEXPS." + (define actions + (map (cut program-file "activate-service.scm" <>) gexps)) + + (with-imported-modules (source-module-closure + '((gnu build activation) + (guix build utils))) + #~(begin + (use-modules (gnu build activation) + (guix build utils)) + + (mkdir-p "/var/run") ;for the PID files + (mkdir-p "/var/log") + + ;; Set up /run/current-system. Among other things this + ;; sets up locales, which the activation snippets + ;; executed below may expect. + (activate-current-system #:kernel-command-line command-line) + + ;; Run the services' activation snippets. + ;; TODO: Use 'load-compiled'. + (for-each primitive-load '#$actions)))) (define (gexps->activation-gexp gexps) "Return a gexp that runs the activation script containing GEXPS." -- 2.26.2