From patchwork Thu Mar 4 06:57:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brice Waegeneire X-Patchwork-Id: 27435 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 7534027BC50; Thu, 4 Mar 2021 06:59:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E301627BC4F for ; Thu, 4 Mar 2021 06:59:20 +0000 (GMT) Received: from localhost ([::1]:44856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHhxA-00076y-62 for patchwork@mira.cbaines.net; Thu, 04 Mar 2021 01:59:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHhws-0006uD-VS for guix-patches@gnu.org; Thu, 04 Mar 2021 01:59:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45982) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHhws-000400-Oa for guix-patches@gnu.org; Thu, 04 Mar 2021 01:59:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lHhws-0000te-Oe for guix-patches@gnu.org; Thu, 04 Mar 2021 01:59:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46560] [PATCH v2 2/2] scripts: system: Activate system when switching generations. Resent-From: Brice Waegeneire Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Mar 2021 06:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46560 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46560@debbugs.gnu.org Cc: ludo@gnu.org Received: via spool by 46560-submit@debbugs.gnu.org id=B46560.16148410913372 (code B ref 46560); Thu, 04 Mar 2021 06:59:02 +0000 Received: (at 46560) by debbugs.gnu.org; 4 Mar 2021 06:58:11 +0000 Received: from localhost ([127.0.0.1]:57526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHhw2-0000sK-OL for submit@debbugs.gnu.org; Thu, 04 Mar 2021 01:58:11 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:29273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHhvz-0000rf-Vo for 46560@debbugs.gnu.org; Thu, 04 Mar 2021 01:58:08 -0500 X-Originating-IP: 176.181.186.101 Received: from localhost (i15-les02-ntr-176-181-186-101.sfr.lns.abo.bbox.fr [176.181.186.101]) (Authenticated sender: brice@waegenei.re) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id EE9CC240003; Thu, 4 Mar 2021 06:58:01 +0000 (UTC) From: Brice Waegeneire Date: Thu, 4 Mar 2021 07:57:54 +0100 Message-Id: <20210304065754.18619-3-brice@waegenei.re> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210304065754.18619-1-brice@waegenei.re> References: <87czx06ubt.fsf@waegenei.re> <20210304065754.18619-1-brice@waegenei.re> 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" X-getmail-retrieved-from-mailbox: Patches Fixes . * 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 ;;; Copyright © 2020 Julien Lepiller ;;; Copyright © 2020 Efraim Flashner +;;; Copyright © 2021 Brice Waegeneire ;;; ;;; 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))