From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GEwWCGG922OPmwAAbAwnHQ (envelope-from ) for ; Thu, 02 Feb 2023 14:40:49 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id uKzKB2G922MpTAAAauVa8A (envelope-from ) for ; Thu, 02 Feb 2023 14:40:49 +0100 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 601A511E2B for ; Thu, 2 Feb 2023 14:40:48 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNZor-0007wX-MZ; Thu, 02 Feb 2023 08:40:05 -0500 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 1pNZoo-0007o1-In for guix-patches@gnu.org; Thu, 02 Feb 2023 08:40:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNZoo-0008Ud-5i for guix-patches@gnu.org; Thu, 02 Feb 2023 08:40:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pNZoo-0002VB-1Q for guix-patches@gnu.org; Thu, 02 Feb 2023 08:40:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59619] [PATCH] grub-configfile tested successfully Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Feb 2023 13:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59619 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "S.Karrmann" Cc: 59619@debbugs.gnu.org Received: via spool by 59619-submit@debbugs.gnu.org id=B59619.16753451429513 (code B ref 59619); Thu, 02 Feb 2023 13:40:01 +0000 Received: (at 59619) by debbugs.gnu.org; 2 Feb 2023 13:39:02 +0000 Received: from localhost ([127.0.0.1]:32920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNZnp-0002T5-Fm for submit@debbugs.gnu.org; Thu, 02 Feb 2023 08:39:02 -0500 Received: from lepiller.eu ([89.234.186.109]:41648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNZnn-0002Su-5k for 59619@debbugs.gnu.org; Thu, 02 Feb 2023 08:39:00 -0500 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 280aa9ac; Thu, 2 Feb 2023 13:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=dkim; bh=lm1l+UtRU/kP vM85Np74+76JkqL5JjUliX8dWD2KWjs=; b=ks38KbamO+u8M5vMUTkHoz4J0jT/ LrR5MCxEQJ0hVTbHoaGxEuZxHCsR85xv41kf2xT20pow7eu7c5Aq6Rj/RBupDG5+ heP2S8WCilEwOx4GrHBsecHKfie2kvwchR3/oWG1xid+WHg22Gd1NOIiTJ6dx3uQ gPZhHC2ODzm7ViDOjE2CI4V0t5qF/Lh3p2t4nyx57pzG+ntXxM3LgKU25Bb80aSl 9hjgaWsTT2yxacxq2QzXkSi1KO0vDeEYoW0u2Q3RWjpfN0Z0pHaSFUUbPZttYphe k0cuuc2ekwfBrsK05SaGmD1kBkjDJ9SkJJRU5KEHU/+/OgL5tOXmdvG4og== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 71afeec6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 2 Feb 2023 13:38:55 +0000 (UTC) Date: Thu, 2 Feb 2023 14:38:41 +0100 From: Julien Lepiller Message-ID: <20230202143841.0f4aeed6@tachikoma.lepiller.eu> In-Reply-To: References: X-Mailer: Claws Mail 4.1.1 (GTK 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675345248; a=rsa-sha256; cv=none; b=h1uxOlRjuNN8VWkbQW1TOhYGZBCZl7y3UxiRdowYJnAomZr2Nf2D23+knRpObdvK6Zp/Oa 7eu+yw7+J0Sd4v/Ubk4/gyex7HIj35bHOT+m1l2um82jhXAbd82LUguvQLFvFFQDTol67y bAUgNxGlhkQSSg+3b83//FwprtNtQbB2OpavZbKvxsXySQnMCTLQFaBAKI7//Qug8Gyi5Q jM0gw/IX/yjdL9+q1S+zNd91DEeeeuewylroNi0iGsLb7YWqhvaUzGzoreCk87S8bRiHCI xJW70A2Ft6Jl1Dr2KUMBcqJlsh14rOECM/HptDGJf+2TzZTAz+9t+u8ecMzd0A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=ks38Kbam; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675345248; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=wqucSZJmQd9nltWYnXjv/Ldw2TcA0oSemQz7yOvKILc=; b=Wg1MpA1VpPN33KrRJwh8HKiZtHNP8lwN+1/BjiIraVzwl+zF85TpmiXhiWwu2uECEOl+xK ABzHuIDSmyTfd+W3IPRyw2yFsOE9/I+YiTjOf4Jo9ud4imNlc25uD0RVNcNIWdyD4rWxqv 1fO23QTxJpGjQXLPI+4v6GrS/FwM6avRlvDJNLC77mdLnfTE5HDpUIadWSqiWHb9q4b037 oFx76jYB/qOUvsurtVLcSnbno4XiNrWUmrLLkBGZvkF+7Fy3wJqG4Mt2K4hqIj81y0Wk2B Idi0NCqUOyClWMV0h/gsIIrmbj3dd1hIjOp5JncNFQ3+qyIiieUWgVJLYLYu3A== X-Migadu-Spam-Score: -1.28 X-Spam-Score: -1.28 X-Migadu-Queue-Id: 601A511E2B X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=ks38Kbam; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-TUID: Ln8oc9ia8KDR thanks for the patch! I was not able to apply it, and it contains unchanged lines, which is weird. Could you rebase the patch on top of master before sending it again? I wasn't able to test it yet, but it looks good :) Le Tue, 31 Jan 2023 18:33:38 +0100, "S.Karrmann" a =C3=A9crit : > Dear all, >=20 > I tested my patch and generated a vm with configfile in its GRUB boot > menu, cf. ~system-config.scm~ in my last post. >=20 > I needed ~make clean-go ; make make-go~ to get consistent compiled > guile code. The guile manual suggested ~--fresh-auto-compile~, but > for this I must call guile directly AFAICS. Some tool for > guile-autocompile would be nice for such developments. >=20 > I hope, this patch makes it into the master branch. It helps to test > install Guix in parallel to another OS. So more people can test it > and will fall in love with Guix, hopefully. >=20 > Kind regards, > Dr. Stefan Karrmann >=20 > --- > doc/guix.texi | 39 > +++++++++++++++++++++++++++++---------- gnu/bootloader.scm | > 29 +++++++++++++++++++++++++---- gnu/bootloader/grub.scm | 11 > +++++++++++ tests/boot-parameters.scm | 11 +++++++++++ > 4 files changed, 76 insertions(+), 14 deletions(-) >=20 > diff --git a/doc/guix.texi b/doc/guix.texi > index 2b1ad77ba5..45f9ed23ed 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -112,6 +112,7 @@ Copyright @copyright{} 2022 John Kehayias@* > Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@* > Copyright @copyright{} 2023 Giacomo Leidi@* > Copyright @copyright{} 2022 Antero Mejr@* > +Copyright @copyright{} 2023 Dr. Stefan Karrmann@* >=20 > Permission is granted to copy, distribute and/or modify this document > under the terms of the GNU Free Documentation License, Version 1.3 or > @@ -6159,7 +6160,7 @@ Transformation Options}) so it should be > lossless. >=20 > @item --profile=3D@var{profile} > @itemx -p @var{profile} > -Create an environment containing the packages installed in > @var{profile}. +Create an environment containing the packages > installed in @var{profile}. Use @command{guix package} > (@pxref{Invoking guix package}) to create and manage profiles. >=20 > @@ -6605,7 +6606,7 @@ interpreted as packages that will be added to > the environment directly. >=20 > @item --profile=3D@var{profile} > @itemx -p @var{profile} > -Create an environment containing the packages installed in > @var{profile}. +Create an environment containing the packages > installed in @var{profile}. Use @command{guix package} > (@pxref{Invoking guix package}) to create and manage profiles. >=20 > @@ -12564,7 +12565,7 @@ candidates, and even to test their impact on > packages that depend on them: >=20 > @example > -guix build elogind --with-source=3D@dots{}/shepherd-0.9.0rc1.tar.gz > +guix build elogind --with-source=3D@dots{}/shepherd-0.9.0rc1.tar.gz > @end example >=20 > @dots{} or to build from a checkout in a pristine environment: > @@ -23482,7 +23483,7 @@ created for. > Restricts all controllers to the specified transport. @code{'dual} > means both BR/EDR and LE are enabled (if supported by the hardware). >=20 > -Possible values are: > +Possible values are: >=20 > @itemize @bullet > @item > @@ -38666,6 +38667,24 @@ The list of commands for loading Multiboot > modules. For example: @dots{})) > @end lisp >=20 > +@item @code{config-file} (default: @code{#f}) > +A string that can be accepted by @code{grub}'s @code{configfile} > +directive. This has no effect if either @code{linux} or > +@code{multiboot-kernel} fields are specified. The following is an > +example of switching to a different GNU/GRUB menu. > + > +@lisp > +(bootloader > + (bootloader-configuration > + ;; @dots{} > + (menu-entries > + (list > + (menu-entry > + (label "GNU/Linux") > + (device (uuid "5cbb9a70-a3c8-4384-a085-9e6896058343")) > + (config-file "/boot/grub/grub.cfg")))))) > +@end lisp > + > @item @code{chain-loader} (default: @code{#f}) > A string that can be accepted by @code{grub}'s @code{chainloader} > directive. This has no effect if either @code{linux} or > @@ -40553,7 +40572,7 @@ A clause can have one of the following forms: > (@var{field-name} > (@var{type} @var{default-value}) > @var{documentation}) > - > + > (@var{field-name} > (@var{type} @var{default-value}) > @var{documentation} > @@ -40602,7 +40621,7 @@ A simple serializer procedure could look like > this: (define (serialize-boolean field-name value) > (let ((value (if value "true" "false"))) > #~(string-append #$field-name #$value))) > -@end lisp > +@end lisp >=20 > In some cases multiple different configuration records might be > defined in the same file, but their serializers for the same type > might have to @@ -40620,7 +40639,7 @@ manually specify a custom > @var{serializer} for every field. >=20 > (define (bar-serialize-string field-name value) > @dots{}) > - > + > (define-configuration foo-configuration > (label > (string) > @@ -40652,7 +40671,7 @@ macro which is a shorthand of this. > (field > (string "test") > "Some documentation.")) > -@end lisp > +@end lisp > @end deffn >=20 > @deffn {Scheme Syntax} define-maybe @var{type} > @@ -43153,7 +43172,7 @@ down in its dependency graph. As it turns > out, GLib does not have a from > /gnu/store/@dots{}-glib-2.62.6/lib/libglib-2.0.so.0 #1 > 0x00007ffff608a7d6 in gobject_init_ctor () from > /gnu/store/@dots{}-glib-2.62.6/lib/libgobject-2.0.so.0 -#2 > 0x00007ffff7fe275a in call_init (l=3D, > argc=3Dargc@@entry=3D1, argv=3Dargv@@entry=3D0x7fffffffcfd8, +#2 > 0x00007ffff7fe275a in call_init (l=3D, > argc=3Dargc@@entry=3D1, argv=3Dargv@@entry=3D0x7fffffffcfd8, > env=3Denv@@entry=3D0x7fffffffcfe8) at dl-init.c:72 #3 0x00007ffff7fe2866 > in call_init (env=3D0x7fffffffcfe8, argv=3D0x7fffffffcfd8, argc=3D1, > l=3D) at dl-init.c:118 @@ -43182,7 +43201,7 @@ Starting > program: /gnu/store/@dots{}-profile/bin/sh -c exec\ inkscape #0 > g_getenv (variable=3Dvariable@@entry=3D0x7ffff60c7a2e "GOBJECT_DEBUG") at > ../glib-2.62.6/glib/genviron.c:252 #1 0x00007ffff608a7d6 in > gobject_init () at ../glib-2.62.6/gobject/gtype.c:4380 #2 > gobject_init_ctor () at ../glib-2.62.6/gobject/gtype.c:4493 -#3 > 0x00007ffff7fe275a in call_init (l=3D, > argc=3Dargc@@entry=3D3, argv=3Dargv@@entry=3D0x7fffffffd088, +#3 > 0x00007ffff7fe275a in call_init (l=3D, > argc=3Dargc@@entry=3D3, argv=3Dargv@@entry=3D0x7fffffffd088, > env=3Denv@@entry=3D0x7fffffffd0a8) at dl-init.c:72 @dots{} @end example > diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index > 2c36d8c6cf..7c24fd2ebf 100644 --- a/gnu/bootloader.scm +++ > b/gnu/bootloader.scm @@ -6,6 +6,7 @@ ;;; Copyright =C2=A9 2020 Jan > (janneke) Nieuwenhuizen ;;; Copyright =C2=A9 2022 > Josselin Poiret ;;; Copyright =C2=A9 2022 Reza Alizadeh > Majd +;;; Copyright =C2=A9 2022 Dr. Stefan Karrmann > ;;; ;;; This file is part of GNU Guix. > ;;; > @@ -49,6 +50,7 @@ > menu-entry-multiboot-arguments > menu-entry-multiboot-modules > menu-entry-chain-loader > + menu-entry-config-file >=20 > menu-entry->sexp > sexp->menu-entry > @@ -109,8 +111,10 @@ > (multiboot-modules menu-entry-multiboot-modules > (default '())) ; list of multiboot > commands, where ; a command is a list of > + (config-file menu-entry-config-file > + (default #f)) ; string, path of > grub.cfg file (chain-loader menu-entry-chain-loader > - (default #f))) ; string, path of efi file > + (default #f))) ; string, path of efi > file >=20 > (define (report-menu-entry-error menu-entry) > (raise > @@ -126,6 +130,7 @@ > @code{linux-arguments} and @code{linux-modules}, > @item multiboot by specifying fields @code{multiboot-kernel}, > @code{multiboot-arguments} and @code{multiboot-modules}, > +@item config-file by specifying field @code{config-file}. > @item chain-loader by specifying field @code{chain-loader}. > @end enumerate")))))) >=20 > @@ -141,7 +146,7 @@ > (match entry > (($ label device mount-point > (? identity linux) linux-arguments (? identity > initrd) > - #f () () #f) > + #f () () #f #f) > `(menu-entry (version 0) > (label ,label) > (device ,(device->sexp device)) > @@ -151,7 +156,7 @@ > (initrd ,initrd))) > (($ label device mount-point #f () #f > (? identity multiboot-kernel) > multiboot-arguments > - multiboot-modules #f) > + multiboot-modules #f #f) > `(menu-entry (version 0) > (label ,label) > (device ,(device->sexp device)) > @@ -159,13 +164,20 @@ > (multiboot-kernel ,multiboot-kernel) > (multiboot-arguments ,multiboot-arguments) > (multiboot-modules ,multiboot-modules))) > - (($ label device mount-point #f () #f #f () () > + (($ label device mount-point #f () #f #f () () #f > (? identity chain-loader)) > `(menu-entry (version 0) > (label ,label) > (device ,(device->sexp device)) > (device-mount-point ,mount-point) > (chain-loader ,chain-loader))) > + (($ label device mount-point #f () #f #f () () > + (? identity config-file) #f) > + `(menu-entry (version 0) > + (label ,label) > + (device ,(device->sexp device)) > + (device-mount-point ,mount-point) > + (config-file ,config-file))) > (_ (report-menu-entry-error entry)))) >=20 > (define (sexp->menu-entry sexp) > @@ -204,6 +216,15 @@ record." > (multiboot-kernel multiboot-kernel) > (multiboot-arguments multiboot-arguments) > (multiboot-modules multiboot-modules))) > + (('menu-entry ('version 0) > + ('label label) ('device device) > + ('device-mount-point mount-point) > + ('config-file config-file) _ ...) > + (menu-entry > + (label label) > + (device (sexp->device device)) > + (device-mount-point mount-point) > + (config-file config-file))) > (('menu-entry ('version 0) > ('label label) ('device device) > ('device-mount-point mount-point) > diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm > index ecd44e7f3c..7ed0d155d8 100644 > --- a/gnu/bootloader/grub.scm > +++ b/gnu/bootloader/grub.scm > @@ -9,6 +9,7 @@ > ;;; Copyright =C2=A9 2020 Stefan > ;;; Copyright =C2=A9 2022 Karl Hallsby > ;;; Copyright =C2=A9 2022 Denis 'GNUtoo' Carikli > +;;; Copyright =C2=A9 2022 Dr. Stefan Karrmann > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -377,6 +378,7 @@ when booting a root file system on a Btrfs > subvolume." (device (menu-entry-device entry)) > (device-mount-point (menu-entry-device-mount-point entry)) > (multiboot-kernel (menu-entry-multiboot-kernel entry)) > + (config-file (menu-entry-config-file entry)) > (chain-loader (menu-entry-chain-loader entry))) > (cond > (linux > @@ -417,6 +419,15 @@ menuentry ~s { > #$root-index (string-join (list #$@arguments) " > " 'prefix) (string-join (map string-join '#$modules) > "\n module " 'prefix)))) > + (config-file > + #~(format port " > +menuentry ~s { > + ~a > + config-file ~a > +}~%" > + #$label > + #$(grub-root-search device config-file) > + #$config-file)) > (chain-loader > #~(format port " > menuentry ~s { > diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm > index 03a1d01aff..f2d1453b2c 100644 > --- a/tests/boot-parameters.scm > +++ b/tests/boot-parameters.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2019, 2020 Miguel =C3=81ngel Arruga Vivas > ;;; Copyright =C2=A9 2022 Josselin Poiret > +;;; Copyright =C2=A9 2022 Dr. Stefan Karrmann > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -318,6 +319,12 @@ > (linux "/boot/bzImage") > (initrd "/boot/initrd.cpio.gz"))) >=20 > +(define %config-file-menu-entry > + (menu-entry > + (label "test-config-file") > + (device (uuid "6d5b13d4-6092-46d0-8be4-073dc07413cc")) > + (config-file "/boot/grub/grub.cfg"))) > + > (test-equal "menu-entry roundtrip, uuid" > %uuid-menu-entry > (sexp->menu-entry (menu-entry->sexp %uuid-menu-entry))) > @@ -326,4 +333,8 @@ > %file-system-label-menu-entry > (sexp->menu-entry (menu-entry->sexp > %file-system-label-menu-entry))) >=20 > +(test-equal "menu-entry roundtrip, config-file" > + %config-file-menu-entry > + (sexp->menu-entry (menu-entry->sexp %config-file-menu-entry))) > + > (test-end "boot-parameters") > -- > 2.30.2 >=20 >=20 >=20 >=20