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 ADfyJqAz9WajNAAAqHPOHw:P1 (envelope-from ) for ; Thu, 26 Sep 2024 10:12:48 +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 ADfyJqAz9WajNAAAqHPOHw (envelope-from ) for ; Thu, 26 Sep 2024 12:12:48 +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=qxxHmfhd; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=oHsBDNbo; 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=1727345568; 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-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=0CaZ9OnPl3/7G2AVIzFTBFAwD5Y8HdNbaKxoXkEs1cA=; b=m1czlTo5WrcBSef72WkCzijfSVr0UrzFu5tvSUbH/MY4sSXKfbp/CxHXEN9/72P9zIlgtR LWWWO7gBGNUmjNcVH0VDTM3yoiz8srK19H9NiIkso7MtBEGQXfPtrcKUbFMCrmOJNVPj8j 0675OGAMMjF37hg/f6freqENQ8XCcotuzX/D+NsnfJ0hBY/bGUoSlD3KOd8s/umg4F4sMg 7vv6PA25UjFDefBDAPmioG7DsSVna0a6crEocdZVeA1XKqb73m2EwrFk0Q0OLBWRSlcblk goH+sO1VN/8HbxcaqbU4VTyFbKldPiIIYR6YQjhwXP2Mc30d37mhoDsWwWtIWg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727345568; a=rsa-sha256; cv=none; b=gTjYiG/JZcS3dFhfs2VvVJMMFenx7mkQrSh4YUI97hYIPff8ZKzm/GnXnECYHNH2QFvw7f g2bSTuKPnc42pppnYUf0PNCa1sOsoKDl2U4kxl4ufYTHY0Oo/L6yGx+2j0nYKXtYQi/pU5 bkAv4BprR0ZFSXENMyPK3ZY6D8MIM0weF0NYWQrIecQOQcTBxYe8/04WW2JKOhXj8LfTZs VYp86FWfxjtzxOFl9tZoyK+A6fAg4BNgGkE5zbCe/4Tkf+q5Fu0IHf0mBztojXn2D0ymV8 BeOQ4zc3sOOjWNclLoJBHXP+BQVYk6mdMmPxb+XZsf6nIzWBr5CCZfRbGYuAnw== 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=qxxHmfhd; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=oHsBDNbo; 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 783511202F for ; Thu, 26 Sep 2024 12:12:48 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stlTK-0002zc-WC; Thu, 26 Sep 2024 06:11:43 -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 1stlTI-0002xh-96 for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:40 -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 1stlTH-0007Px-Th for guix-patches@gnu.org; Thu, 26 Sep 2024 06:11:39 -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=QJoHxVO8C/6UH6ICoo6AdFAwpNBVhW1OBOxGDYtZPB8=; b=qxxHmfhdMOGNJDpEJurBpuUA2v+9/iiP2T2N7Al535yzmh0JqmKNppDgaAOZj2nDvxt0gItty0TXBOihumnyr38XeLuDsLi5gUszagWlYI39mDE8wvKRDvQ/2kF+7GSAVr+tR+++12NrBZOBRid/4XwK8J+fy+UUnNROa3+cR5P9GVXe5kaSHlwDf6Tlw7DGAx5/DeYyZhGUY/lgLfohaHTAGeIki9L898ZlyliXlobkGetqZI2y2H97tZl5/dtXly0WOuRZ1ZeWkcWppK86PwGZhIvJnGTdkfnxzvy2BnAKEt56UdTs2Yp08XjLP2lUA1ERngFcczywKEb3/JFduQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stlTi-0003VD-QA; Thu, 26 Sep 2024 06:12:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73202] [PATCH v3 10/14] gnu: bootloader: Add device-subvol field to menu-entry record. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: lilah@lunabee.space, guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2024 10:12:06 +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 , Lilah Tascheter X-Debbugs-Original-Xcc: Lilah Tascheter Received: via spool by 73202-submit@debbugs.gnu.org id=B73202.172734550613318 (code B ref 73202); Thu, 26 Sep 2024 10:12:06 +0000 Received: (at 73202) by debbugs.gnu.org; 26 Sep 2024 10:11:46 +0000 Received: from localhost ([127.0.0.1]:55502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlTN-0003Sd-W5 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:46 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:53171 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stlT0-0003PN-N9 for 73202@debbugs.gnu.org; Thu, 26 Sep 2024 06:11:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727345441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0CaZ9OnPl3/7G2AVIzFTBFAwD5Y8HdNbaKxoXkEs1cA=; b=oHsBDNbo9zsYzY5wl6UGUWFYBDWzaMVU78yNAvX7nrvXzPzjTUPztp1HTlGaIgycYZkeC6 f/YEjFKUb9AWndNu8QnjSx2zwoNsOiX5XA0dz0sQI4+zHtYkRUhyONNNW4aqQ6rvts80iq +MNBkaPMVvQNGxPJH00ATf7rE4EB02XHOZzqbtIqOtpjzDYxZeWhHQQeO5sXkQDd0E2wLf 8FF14MHqLRl7xLcHzDd0CVW9Y4LbsBXxidGKq+phc/YmnVrKBc4P2kJguZCbdfBCIKDtv+ rUtxYdxMyGULTZNxHU0ZE+kR07qjTuKs3sYIrxNl67VUbEEDfdGL2natief0Mw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 8c230017 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Thu, 26 Sep 2024 10:10:41 +0000 (UTC) Date: Thu, 26 Sep 2024 12:09:07 +0200 Message-ID: <33b51456dc709d17c8be3776471e0599f83eaec1.1727345067.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> References: <74c789e74594d538308d33633ed8540283dcde49.1727345067.git.herman@rimm.ee> MIME-Version: 1.0 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.41 X-Spam-Score: -4.41 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Queue-Id: 783511202F X-TUID: xpYR8dwEpQRJ 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 | 1 + 2 files changed, 40 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 54e5673a54..98fcd2b3a0 100644 --- a/gnu/system/boot.scm +++ b/gnu/system/boot.scm @@ -328,6 +328,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