From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 8BEFCDVR7WZZewAAqHPOHw:P1 (envelope-from ) for ; Fri, 20 Sep 2024 10:40:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 8BEFCDVR7WZZewAAqHPOHw (envelope-from ) for ; Fri, 20 Sep 2024 12:40:53 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=QTSRWPq7; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=e7+jliFt; dmarc=pass (policy=none) header.from=gnu.org; 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=1726828852; h=from:from:sender:sender:reply-to: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=lPgCs4Nu2yl6xykEjUSkcYZmYylDxuSJxq1PmguWGiI=; b=liVhcP+EZE3t0OPCkixT77msltQR6kDq/KpVV79ZgjUzRBtSJgi53x3y3BCk+x60PKa0TY HksIf/Zw/H98OoI1p8pUX5SfoTMPW2sJVKwHIP8JubWiumr3DMH1szeS0bSfZc7VH5vPyU W5g/ipG9uiqGrDHLyHhdrp7VT4HXmYw6s5sC+Gymft6gyGnxi2Fos5MIZ1a8lEh4Hw8QN+ 2+Mk82bEAY1GbfZyke+RfRXVEiWt8lOO1T4S6Q/60YuzvoPOwbMNRadp++sMHJOqWGtJ9q 9UR4Hcp/TB0B8qrp7EyJ/OUomFCtWplpjLh3zGIu96mv3fpdCSAbVItrsAJ/eg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726828852; a=rsa-sha256; cv=none; b=ZmB9RO53PptlDd3zIeetZTK5DAHYEqVa3z975ya4OnkLw3ZsarK7pJ2Ca0QrzbsohzBM8T jT0LDvSUU/pgossg685kV1tU+K9xJbK4e89Zp5bwnF3My9d0ILcRe4UIumjo+RZX0mkxmS Ur8wmqKW1kVBR0vAkz0W2QCgcUWqOJQNBt06zQtzyxkQzG+Be1/vtE237Hg1O79CltifpH oxGHcuN6fl0mlUw6S1zxN4ecQDhegSq0LuYpCK20Aqnj38x+q2mcoFgqezLBcd4rCQsJ3K 0uagy0hR9N+ecbKYnHR1+XJTcEe7eZ0t1DLVNu6s5VD76tWMcYOXBvXI263wHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=QTSRWPq7; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=e7+jliFt; dmarc=pass (policy=none) header.from=gnu.org; 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" 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 C943BE0F4 for ; Fri, 20 Sep 2024 12:40:52 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srb3h-0005EW-7q; Fri, 20 Sep 2024 06:40:17 -0400 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 1srb3F-0004xz-Ua for guix-patches@gnu.org; Fri, 20 Sep 2024 06:39:50 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srb3F-0006UR-Ju for guix-patches@gnu.org; Fri, 20 Sep 2024 06:39:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=mbxK+LC54g4b+R895o6udcWF7gRGDEpWPxjWt/ggdjQ=; b=QTSRWPq7c5wBqbZCOcm4kDHQdyltluFSo5S2fTwxGlpBe0Xi+DXVy1DwSpwQQcYPLb/hX/AGlaSJqqkY94qR4TD/y3ZZz3iq3QSRA+eWgGkzgCQjNYW6B+vfWQYtP48JmzkSWRIaqyW7hECADm950mGoNAFou+WScKBKVUqlKBMeYMr/GXE505MbjhlJUbG/6wT/gM1t29lBTT3NUwipBAEpKPsN6/JT2sYxm/3GzoVs8NQsc7I0QaBg8X82RsfGP60j9T42A61Q/4EfhoyBiOFBaTFR8ZwBzJOWyW6jbqM3/m3oYbB00/mg8nT3n0VCQIbD3at/XWKzdXOrR440jA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srb3Y-0001QJ-7j for guix-patches@gnu.org; Fri, 20 Sep 2024 06:40:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v2 10/15] gnu: bootloader: Add device-subvol field to menu-entry record. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Sep 2024 10:40:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73202@debbugs.gnu.org Cc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.17268287835308 (code B ref 73202); Fri, 20 Sep 2024 10:40:08 +0000 Received: (at 73202) by debbugs.gnu.org; 20 Sep 2024 10:39:43 +0000 Received: from localhost ([127.0.0.1]:34171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srb38-0001NS-GG for submit@debbugs.gnu.org; Fri, 20 Sep 2024 06:39:43 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:49077 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srb2w-0001LI-5e for 73202@debbugs.gnu.org; Fri, 20 Sep 2024 06:39:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1726828737; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=lPgCs4Nu2yl6xykEjUSkcYZmYylDxuSJxq1PmguWGiI=; b=e7+jliFtqPuCg+sNox+M13LTVjTnfUNncj7uty+3uLn/jlq3mQoefZx4Af9+W6n2ThzfNN R1Z2YJgnQxl2IJ2/21b8fqzf4n3m974EJrRZ1Hhw/UBNYFAGXZPpXB75PYuPdk9fbwLq/0 ZRINOJGm/Z4Yj8uR2w7u/UxxakYODqDxEc/Ko287RFGIIDlZXW0uiugNGYBfvCskLrd9AS wyOrMzTX5AjMoAb5NOZDsmYkqC1DWNdPA9+j2kO52QDskOCe1NCB+QH5tL7yVfzWlBz0VB wsq+BPqhaIJUeV8Ii+Gs1tl+ominxhGzXkakiRxMxWb2srwFhjOBbtXe0/Fmaw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id e97864cb (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Fri, 20 Sep 2024 10:38:57 +0000 (UTC) Date: Fri, 20 Sep 2024 12:37:55 +0200 Message-ID: <9ebe41c442f375788d3783fb780d11f8bdf3ed75.1726827025.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm via Guix-patches via 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 X-Migadu-Spam-Score: -4.91 X-Spam-Score: -4.91 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Queue-Id: C943BE0F4 X-TUID: ZU/0y0gttKsW From: Lilah Tascheter * gnu/bootloader.scm (menu-entry-device-subvol): Add and export field. (normalize-file): Add procedure. (device->sexp): Match device-subvol and include in S-expression. (sexp->menu-entry): Try match device-subvol and include in menu-entry. * gnu/system/boot.scm (boot-parameters->menu-entry): Add device-subvol value to menu-entry. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- gnu/bootloader.scm | 51 ++++++++++++++++++++++++++++++++++----------- gnu/system/boot.scm | 2 ++ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index c77de6f55e..f1352122a9 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -51,15 +51,17 @@ (define-module (gnu bootloader) menu-entry? menu-entry-label menu-entry-device + menu-entry-device-mount-point + menu-entry-device-subvol menu-entry-linux menu-entry-linux-arguments menu-entry-initrd - menu-entry-device-mount-point menu-entry-multiboot-kernel menu-entry-multiboot-arguments menu-entry-multiboot-modules menu-entry-chain-loader + normalize-file menu-entry->sexp sexp->menu-entry @@ -126,6 +128,8 @@ (define-record-type* (default #f)) (device-mount-point menu-entry-device-mount-point (default #f)) + (device-subvol menu-entry-device-subvol + (default #f)) (linux menu-entry-linux (default #f)) (linux-arguments menu-entry-linux-arguments @@ -142,6 +146,18 @@ (define-record-type* (chain-loader menu-entry-chain-loader (default #f))) ; string, path of efi file +(define (normalize-file entry file) + "Normalize a file FILE stored in a menu entry into one suitable for a +bootloader. Realizes device-mount-point and device-subvol." + (match-menu-entry entry (device-mount-point device-subvol) + ;; Avoid using cut procedure from SRFI-26 inside G-exp. + (let ((mount (and=> device-mount-point (cut string-trim <> #\/)))) + #~(let* ((file (string-trim #$file #\/)) + (file (if (and #$mount (string-prefix? #$mount file)) + (substring file (string-length #$mount)) + file))) + (string-append (or #$device-subvol "") "/" file))))) + (define (report-menu-entry-error menu-entry) (raise (condition @@ -169,7 +185,7 @@ (define (menu-entry->sexp entry) `(label ,(file-system-label->string label))) (_ device))) (match entry - (($ label device mount-point + (($ label device mount-point subvol (? identity linux) linux-arguments (? identity initrd) #f () () #f) `(menu-entry (version 0) @@ -178,8 +194,9 @@ (define (menu-entry->sexp entry) (device-mount-point ,mount-point) (linux ,linux) (linux-arguments ,linux-arguments) - (initrd ,initrd))) - (($ label device mount-point #f () #f + (initrd ,initrd) + (device-subvol ,subvol))) + (($ label device mount-point subvol #f () #f (? identity multiboot-kernel) multiboot-arguments multiboot-modules #f) `(menu-entry (version 0) @@ -188,19 +205,23 @@ (define (menu-entry->sexp entry) (device-mount-point ,mount-point) (multiboot-kernel ,multiboot-kernel) (multiboot-arguments ,multiboot-arguments) - (multiboot-modules ,multiboot-modules))) - (($ label device mount-point #f () #f #f () () + (multiboot-modules ,multiboot-modules) + (device-subvol ,subvol))) + (($ label device mount-point subvol #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))) + (chain-loader ,chain-loader) + (device-subvol ,subvol))) (_ (report-menu-entry-error entry)))) (define (sexp->menu-entry sexp) "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a record." + ;; XXX: The match ORs shadow subvol. + (define subvol #f) (define (sexp->device device-sexp) (match device-sexp (('uuid type uuid-string) @@ -213,35 +234,41 @@ (define (sexp->menu-entry sexp) ('label label) ('device device) ('device-mount-point mount-point) ('linux linux) ('linux-arguments linux-arguments) - ('initrd initrd) _ ...) + ('initrd initrd) + (or ('device-subvol subvol _ ...) (_ ...))) (menu-entry (label label) (device (sexp->device device)) (device-mount-point mount-point) + (device-subvol subvol) (linux linux) (linux-arguments linux-arguments) (initrd initrd))) (('menu-entry ('version 0) ('label label) ('device device) - ('device-mount-point mount-point) + ('device-mount-point mount-point) ('device-subvol subvol) ('multiboot-kernel multiboot-kernel) ('multiboot-arguments multiboot-arguments) - ('multiboot-modules multiboot-modules) _ ...) + ('multiboot-modules multiboot-modules) + (or ('device-subvol subvol _ ...) (_ ...))) (menu-entry (label label) (device (sexp->device device)) (device-mount-point mount-point) + (device-subvol subvol) (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) - ('chain-loader chain-loader) _ ...) + ('device-mount-point mount-point) ('device-subvol subvol) + ('chain-loader chain-loader) + (or ('device-subvol subvol _ ...) (_ ...))) (menu-entry (label label) (device (sexp->device device)) (device-mount-point mount-point) + (device-subvol subvol) (chain-loader chain-loader))))) diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm index a898ab9549..8a183ebe3a 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -16,6 +16,7 @@ ;;; Copyright © 2021 raid5atemyhomework ;;; Copyright © 2023 Bruno Victal ;;; Copyright © 2023 Felix Lechner +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -332,6 +333,7 @@ (define (boot-parameters->menu-entry conf) (label (boot-parameters-label conf)) (device (boot-parameters-store-device conf)) (device-mount-point (boot-parameters-store-mount-point conf)) + (device-subvol (boot-parameters-store-directory-prefix conf)) (linux (and (not multiboot?) kernel)) (linux-arguments (if (not multiboot?) (boot-parameters-kernel-arguments conf) -- 2.45.2