unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Brice Waegeneire <brice@waegenei.re>
To: 46560@debbugs.gnu.org
Cc: ludo@gnu.org
Subject: [bug#46560] [PATCH v2 2/2] scripts: system: Activate system when switching generations.
Date: Thu,  4 Mar 2021 07:57:54 +0100	[thread overview]
Message-ID: <20210304065754.18619-3-brice@waegenei.re> (raw)
In-Reply-To: <20210304065754.18619-1-brice@waegenei.re>

Fixes <https://bugs.gnu.org/38884>.

* guix/scripts/system.scm (switch-to-system-generation): Load the
activate script for that generation.

squash! scripts: system: Activate system when switching generations.
---
 guix/scripts/system.scm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index e3cf99acc6..c226f08371 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -363,11 +364,14 @@ connection to the store."
   "Switch the system profile to the generation specified by SPEC, and
 re-install bootloader with a configuration file that uses the specified system
 generation as its default entry.  STORE is an open connection to the store."
-  (let ((number (relative-generation-spec->number %system-profile spec)))
+  (let* ((number (relative-generation-spec->number %system-profile spec))
+         (generation (generation-file-name %system-profile number))
+         (activate (string-append generation "/activate")))
     (if number
         (begin
           (reinstall-bootloader store number)
-          (switch-to-generation* %system-profile number))
+          (switch-to-generation* %system-profile number)
+          (unless-file-not-found (primitive-load activate)))
         (leave (G_ "cannot switch to system generation '~a'~%") spec))))
 
 (define* (system-bootloader-name #:optional (system %system-profile))
-- 
2.30.1





  parent reply	other threads:[~2021-03-04  6:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 12:35 [bug#46560] [PATCH 0/2] Activate system when switching generations Brice Waegeneire
2021-02-16 13:22 ` [bug#46560] [PATCH 1/2] gnu: services: Add activate script to the profile system directory Brice Waegeneire
2021-03-01 15:55   ` [bug#46560] [PATCH 0/2] Activate system when switching generations Ludovic Courtès
2021-02-16 13:22 ` [bug#46560] [PATCH 2/2] scripts: system: " Brice Waegeneire
2021-03-01 15:56   ` [bug#46560] [PATCH 0/2] " Ludovic Courtès
2021-03-04  6:57 ` [bug#46560] [PATCH v2 " Brice Waegeneire
2021-03-04  6:57   ` [bug#46560] [PATCH v2 1/2] gnu: services: Add activate script to the profile system directory Brice Waegeneire
2021-03-04  6:57   ` Brice Waegeneire [this message]
2021-03-08 14:15   ` [bug#46560] [PATCH v2 0/2] Activate system when switching generations Ludovic Courtès
2021-03-09  6:12     ` bug#46560: [PATCH " Brice Waegeneire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210304065754.18619-3-brice@waegenei.re \
    --to=brice@waegenei.re \
    --cc=46560@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).