|
1 | 1 | bootc --source-imgref containers-storage:ghcr.io/carletoncomputersciencesociety/arcade-machine:latest --target-imgref ghcr.io/carletoncomputersciencesociety/arcade-machine:latest |
2 | 2 |
|
3 | | -%pre --interpreter=/bin/bash |
| 3 | +cmdline |
| 4 | + |
| 5 | +%pre --erroronfail --interpreter=/bin/bash |
| 6 | +
|
| 7 | +# Output to TTY |
| 8 | +exec &>>/dev/tty1 |
| 9 | +
|
| 10 | +declare -a target_disks |
| 11 | +
|
| 12 | +for dev in /sys/block/*; do |
| 13 | + name=$(basename "$dev") |
| 14 | + # Skip partitions (whole disks only) |
| 15 | + [ -f "$dev/partition" ] && continue |
| 16 | + # Skip removable media (USB installer, CD/DVD) |
| 17 | + removable=$(cat "$dev/removable" 2>/dev/null) |
| 18 | + [ "$removable" -eq 1 ] && continue |
| 19 | + target_disks+=("$name") |
| 20 | +done |
| 21 | +
|
| 22 | +count=${#target_disks[@]} |
| 23 | +
|
| 24 | +if [ "$count" -eq 0 ]; then |
| 25 | + echo "ERROR: No non-removable disk found. Aborting." >&2 |
| 26 | + exit 1 |
| 27 | +elif [ "$count" -gt 1 ]; then |
| 28 | + echo "ERROR: Multiple non-removable disks found: ${target_disks[*]}" >&2 |
| 29 | + exit 1 |
| 30 | +fi |
| 31 | +
|
| 32 | +TARGET_DISK="${target_disks[0]}" |
| 33 | +echo "Will install to $TARGET_DISK" |
| 34 | +
|
| 35 | +cat > /tmp/disk-include <<EOF |
| 36 | +ignoredisk --only-use=$TARGET_DISK |
| 37 | +EOF |
| 38 | +
|
4 | 39 | read -p "Press Enter to begin installation (or Ctrl+C to abort): " _ |
5 | | -%end |
6 | 40 |
|
7 | | -cmdline |
| 41 | +%end |
8 | 42 |
|
9 | | -ignoredisk --only-use=sda |
| 43 | +%include /tmp/disk-include |
10 | 44 | zerombr |
11 | 45 | clearpart --all --initlabel |
12 | 46 | autopart --type=plain --fstype=xfs --nohome --noswap |
|
0 commit comments