From 8e5f71712a28c206d4d937e4d9794a487bb5188a Mon Sep 17 00:00:00 2001 From: Marek Paśnikowski Date: Sun, 13 Oct 2024 17:06:21 +0200 Subject: refactor(mcdowell): create dynamic reference to the system device for grub --- machines/amd64.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'machines') diff --git a/machines/amd64.scm b/machines/amd64.scm index 6532ef9..4730607 100644 --- a/machines/amd64.scm +++ b/machines/amd64.scm @@ -44,3 +44,22 @@ (swap-space* (swap-space (target target*)))) (list swap-space*))) + +;;;??????????????????????????????????????????????????????????????????? + +(define-public (bootloader-device-path host-name) + (let* + ((close-pipe (@ (ice-9 popen) close-pipe)) + (open-input-pipe (@ (ice-9 popen) open-input-pipe)) + (read-line (@ (ice-9 rdelim) read-line)) + (command-chain (string-append "findmnt -o SOURCE,LABEL " + "| grep " + host-name + " " + "| head -n 1 " + "| awk '{print $1}' " + "| sed 's/[0-9]*$//' ")) + (port (open-input-pipe command-chain)) + (output (read-line port))) + (close-pipe port) + output)) -- cgit v1.2.3