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.
This commit is contained in:
James Shubin
2025-06-02 15:09:41 -04:00
parent 81063ae6df
commit d14930ef28

View File

@@ -73,6 +73,21 @@ firewall --enabled --service=mdns
# partitioning # partitioning
# #
# TODO: add more magic partitioning schemes # 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 zerombr
clearpart --all --initlabel --disklabel={{ if .bios }}msdos{{ else }}gpt{{ end }} clearpart --all --initlabel --disklabel={{ if .bios }}msdos{{ else }}gpt{{ end }}
{{ if eq .part "btrfs" -}} {{ if eq .part "btrfs" -}}