From d14930ef2839f29271386d35d38a6781270189c1 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Mon, 2 Jun 2025 15:09:41 -0400 Subject: [PATCH] lang: core: embedded: provisioner: Don't provision to USB disks This should hopefully skip over any USB drives. Of course if we actually want to provision to a USB drive, then we'll have to add a feature flag for that. --- .../embedded/provisioner/files/kickstart.ks.tmpl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lang/core/embedded/provisioner/files/kickstart.ks.tmpl b/lang/core/embedded/provisioner/files/kickstart.ks.tmpl index 14e7ac61..98106802 100644 --- a/lang/core/embedded/provisioner/files/kickstart.ks.tmpl +++ b/lang/core/embedded/provisioner/files/kickstart.ks.tmpl @@ -73,6 +73,21 @@ firewall --enabled --service=mdns # partitioning # # TODO: add more magic partitioning schemes + +%pre --interpreter=/bin/bash +# detect all USB disks using udevadm (we want to ignore ipxe disks for example) +usb_disks=$(for dev in /sys/block/sd*; do + devname=$(basename "$dev") + if udevadm info --query=property --name=/dev/$devname | grep -q '^ID_BUS=usb'; then + echo -n "$devname" + fi +done | paste -sd, -) + +# Output the ignoredisk directive to a temporary file. +echo "ignoredisk --drives=${usb_disks}" > /tmp/ignoredisk.ks +%end +%include /tmp/ignoredisk.ks + zerombr clearpart --all --initlabel --disklabel={{ if .bios }}msdos{{ else }}gpt{{ end }} {{ if eq .part "btrfs" -}}