From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QBL+GJgJ3GMMLQEAbAwnHQ (envelope-from ) for ; Thu, 02 Feb 2023 20:06:00 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cBURGZgJ3GP3/gAAauVa8A (envelope-from ) for ; Thu, 02 Feb 2023 20:06:00 +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 BEB482C24C for ; Thu, 2 Feb 2023 20:05:59 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNeuB-0008Qz-6r; Thu, 02 Feb 2023 14:05:55 -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 1pNetK-0008Dh-Oz for guix-patches@gnu.org; Thu, 02 Feb 2023 14:05:03 -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 1pNetK-00051z-Bz for guix-patches@gnu.org; Thu, 02 Feb 2023 14:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pNetJ-0005wb-Nb for guix-patches@gnu.org; Thu, 02 Feb 2023 14:05:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59619] [PATCH] grub-configfile tested References: In-Reply-To: Resent-From: "S.Karrmann" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Feb 2023 19:05: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: 59619@debbugs.gnu.org Received: via spool by 59619-submit@debbugs.gnu.org id=B59619.167536467422809 (code B ref 59619); Thu, 02 Feb 2023 19:05:01 +0000 Received: (at 59619) by debbugs.gnu.org; 2 Feb 2023 19:04:34 +0000 Received: from localhost ([127.0.0.1]:35807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNess-0005vp-2y for submit@debbugs.gnu.org; Thu, 02 Feb 2023 14:04:34 -0500 Received: from mout.web.de ([217.72.192.78]:38909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNesp-0005vZ-CF for 59619@debbugs.gnu.org; Thu, 02 Feb 2023 14:04:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1675364662; bh=od+jNOLDWEjEdzkQsTpNdixOS0xk294Yyh5467hoDFc=; h=X-UI-Sender-Class:Date:From:To:Subject; b=ixpg53SsXl/rfllRwj2RqC0R1MJ8JIC+oTzTKyqpaFAM7BjNhuGVLhRtq/axpYUeQ R6Y5L5/5W+R96x9v+tnZhFtnceEtXYU5/GNUVoeU/WE313fj/Dr1A7vriS31QUt7L0 ZxslJRHTegp+2z/054yRFpRWRcnTLK0kjvKdK/Ml7XfYCm5rxdXdHRrUFDpVN9XETj 09KaMYcnBFhA6RQHgRNl4oWpFsCGdwaf0ZCwIBkIYHQbgOull++IXSWW0SDFvSthBQ qiwiiXFYAfZokfmyAdiXSN0EjT6vy6NtcPUMTVOC1HnUIBHhntW7iAep7Wx82YIMlW 9Yh63jGceDPIg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from localhost ([188.98.113.9]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M43GU-1pNesg2F7Y-000DOM for <59619@debbugs.gnu.org>; Thu, 02 Feb 2023 20:04:22 +0100 Date: Thu, 2 Feb 2023 20:04:21 +0100 From: "S.Karrmann" Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Etmsa7wh/TLtiH3jnPYjyKmL9aLNGps4+B8IIdTW8kNbo0GNEEw gUHY0+C/C6j+wHGIbub3hdom5j8SKDe4Vyzi1m4AeGN7yG4K/qLwhVwzMlyIGwclvGUfr61 XR4AuuQFFEyvC5hCopCXPaf0IdyTmoGJRzIZyDZ8KzqROiDRCiWeETbReYd2yUp2tgLMS6h t5aQPAFWTRHhdBjOkSxAw== UI-OutboundReport: notjunk:1;M01:P0:6oPH58MOWqQ=;ZMyTanZUcOz2wT+NQr4iYbKoq0q cNanTnzmqInqCg9ah7m93PGPbXb7FD1Z2yvcEgzPk0yF9BvCH3gsPk9Gym6nxvCXNsieipEMC j3VdeckvJbzf+rZjUPgu3CBiPjAu3Do6iu1wkScNXlAKfyIyvqUhMIKWDwCDe8rfIlB/6CmrV IY7cGgXa9X4b50mOl4GTnzSKQd8OkjmsiPBEjAqZHWhVYtGJbWcNqWD6KAUxKuf7WyUdls+TI wZRne5GW/E21iInGUtKJWZ+2hypaRoym/TFeM7AznjbaJAPnZvFjumfGI4IHATz+F4zoR2qxa gaOCiNTSGtDxFh/AL02eE5Ytsee7wK+gRGxGzeUfVoc4jKH927R5CxmcqhWHxCJIXIabGDuUC keb5sSD3Cz3v1MueUmlOki8N5HMB3AzgeiV1hNP4yT3O04108Srq9SqMJjWeDomUF72IcH3sl VtHe9F5LTAD5HkiwAnFMJlxPg/qke8qysF4NY9zK5ab/Kq5fTBLCNHrYu0kLf6N0zjFXLQh/w B4wNW4iU1rL+/0Ne/9DSBpGLB8ZuLE/im+um8VkVQnj1ruMlSK/uDnQQXlVNvV8W2nBTW/Y+f J0FH3oqsHnyqoxmm5kXrKakJAaJsksZ3IvZEyYF0n5Z3V+haf+jbFA/qb/CjY7lU9C0xFzUmo 8QU4ZUZ8O3xNRq0PSD3dk9miXE6zwZxJsckdlCVdYGDeIbvNsW/+MRG8Isg08Zr+NSq1KPGHy dBApKVvsbvup2OlXsRLBHjjZmuoIRRVEdx/aCoxGgYLVqLplVisAYefGpW/smcSR+hJTopT3S C54ssJgGRV7SyarrpCNx8oyrbLJ4bTTMlW30kcfcwX/1iv2mwLayKims5EUmOw8GnUN/g+Lw+ FOTjIh8WICGgt7AuLj6oPGtmYKMqALVTUWlL+BZJTkm7/Jwovc6ksqQ3RtDDgCtUuDWv8eXbG KnL4tA== 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=1675364759; a=rsa-sha256; cv=none; b=SJCgnnpXstvYW8Gjzj0P+t09P/dzO/0SiDD5cgKyAH5+E8wh0+oE8FcMzb9MWvLDQiEns0 zhT1FotQDXIeIQqhNLnnQNhlHP8sMqlRKFHT8OHgUC38vaEQpiTiLSvlUi/1rUOdQqsPze VNiCPDYIgKvTtM3GD/SB/yVwvERUuWotV2sSYMI0BFTY+IvlGgwEBLnWbGzVKEJ9VDD5Rs fLBgZXeH/a1cf//6z548ZcicReMmiYC/d8+JNfT4wflmFCgQ2W6WCIPiL7KzE2hBzuuqTa lj4AXKHW40hfyU4NCmJO4BcCnG2sj0WF1D2MoVmjOYC37PalqIhe74GIAobXDA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=web.de header.s=s29768273 header.b=ixpg53Ss; dmarc=fail reason="SPF not aligned (relaxed)" header.from=web.de (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=1675364759; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=S/nGqpAFpz8n8OwfA76z1fhrw3vQgNwsk6ibwkbwEmI=; b=Bm5BOuBu4mdAJc+b4y3sZLUM4vs5fU36nIp9i5P3PVlyvUYvNRKfrn8AxHz2QxmSQRVB1g 627DENI4j4MZj+9IqD1Q1763yMH/79mqeDK36NXNSG5s5UJI9mjGjnn+KXHhG0QtzA0cOW ha/xiIm6cwc6yuVZ5mrwvr/R7RqD03238TGEVcp8ul4rwpCAAw0Gu2+JRGbEic5Clu44gH iZ01zF7G57fM+cIfKbiYIBJSjladUsJHPxOZeoXRbD/YLfbRybXGJiGArusM6Y4rLPQrlM EsKervGmwGdsb8mrubgFtqWbkvhaSoK3vdDSn1kxOCSa2+OQbf4F79Z56JxN9Q== X-Migadu-Spam-Score: -1.78 X-Spam-Score: -1.78 X-Migadu-Queue-Id: BEB482C24C X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=web.de header.s=s29768273 header.b=ixpg53Ss; dmarc=fail reason="SPF not aligned (relaxed)" header.from=web.de (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: f9a8UdbHVN7r now I generated this patch by: git pull git format-patch -o patches --ignore-space-at-eol origin/master..HEAD My Emacs deletes intentionally all space at eol. Therefore, the other patc= h may work with: git apply --whitespace=3Dwarn grub-configfile.patch =2D-- doc/guix.texi | 19 +++++++++++++++++++ gnu/bootloader.scm | 29 +++++++++++++++++++++++++---- gnu/bootloader/grub.scm | 11 +++++++++++ tests/boot-parameters.scm | 11 +++++++++++ 4 files changed, 66 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 64873db00b..937f7c54cb 100644 =2D-- 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@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -38666,6 +38667,24 @@ The list of commands for loading Multiboot module= s. For example: @dots{})) @end lisp +@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 diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 2c36d8c6cf..7c24fd2ebf 100644 =2D-- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -6,6 +6,7 @@ ;;; Copyright =A9 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright =A9 2022 Josselin Poiret ;;; Copyright =A9 2022 Reza Alizadeh Majd +;;; Copyright =A9 2022 Dr. Stefan Karrmann ;;; ;;; This file is part of GNU Guix. ;;; @@ -49,6 +50,7 @@ (define-module (gnu bootloader) menu-entry-multiboot-arguments menu-entry-multiboot-modules menu-entry-chain-loader + menu-entry-config-file menu-entry->sexp sexp->menu-entry @@ -109,8 +111,10 @@ (define-record-type* (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 fil= e (chain-loader menu-entry-chain-loader - (default #f))) ; string, path of efi file + (default #f))) ; string, path of efi file (define (report-menu-entry-error menu-entry) (raise @@ -126,6 +130,7 @@ (define (report-menu-entry-error menu-entry) @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")))))) @@ -141,7 +146,7 @@ (define (device->sexp device) (match entry (($ label device mount-point (? identity linux) linux-arguments (? identity initr= d) - #f () () #f) + #f () () #f #f) `(menu-entry (version 0) (label ,label) (device ,(device->sexp device)) @@ -151,7 +156,7 @@ (define (device->sexp device) (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 @@ (define (device->sexp device) (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)))) (define (sexp->menu-entry sexp) @@ -204,6 +216,15 @@ (define (sexp->device device-sexp) (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 =2D-- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -9,6 +9,7 @@ ;;; Copyright =A9 2020 Stefan ;;; Copyright =A9 2022 Karl Hallsby ;;; Copyright =A9 2022 Denis 'GNUtoo' Carikli +;;; Copyright =A9 2022 Dr. Stefan Karrmann ;;; ;;; This file is part of GNU Guix. ;;; @@ -377,6 +378,7 @@ (define (menu-entry->gexp entry) (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 @@ (define (menu-entry->gexp entry) #$root-index (string-join (list #$@arguments) " " 'pr= efix) (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 =2D-- a/tests/boot-parameters.scm +++ b/tests/boot-parameters.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =A9 2019, 2020 Miguel =C1ngel Arruga Vivas ;;; Copyright =A9 2022 Josselin Poiret +;;; Copyright =A9 2022 Dr. Stefan Karrmann ;;; ;;; This file is part of GNU Guix. ;;; @@ -318,6 +319,12 @@ (define %file-system-label-menu-entry (linux "/boot/bzImage") (initrd "/boot/initrd.cpio.gz"))) +(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 @@ (define %file-system-label-menu-entry %file-system-label-menu-entry (sexp->menu-entry (menu-entry->sexp %file-system-label-menu-entry))) +(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") =2D- 2.39.1