summaryrefslogtreecommitdiff
path: root/machines
diff options
context:
space:
mode:
authorMarek Paśnikowski <marek@marekpasnikowski.pl>2024-10-13 17:06:21 +0200
committerMarek Paśnikowski <marek@marekpasnikowski.pl>2024-10-13 17:06:21 +0200
commit8e5f71712a28c206d4d937e4d9794a487bb5188a (patch)
treed68d5c53877d4e82fb54dd649fb42a228b859158 /machines
parentc13149846099e768efae6c2c126047c1b9d3d4bb (diff)
refactor(mcdowell): create dynamic reference to the system device for grub
Diffstat (limited to 'machines')
-rw-r--r--machines/amd64.scm19
1 files changed, 19 insertions, 0 deletions
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))