aboutsummaryrefslogtreecommitdiff
path: root/installer/lib/config.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-08-14 09:59:55 -0500
committerCraig Jennings <c@cjennings.net>2026-08-14 09:59:55 -0500
commit1a900e50433b0fcd3a192eed1c7989233a6928cf (patch)
treefe558b95439053b7bfd3be7297dc8ef00db2f3a9 /installer/lib/config.sh
parent4186fcf3f75831b28333dbfb0814318ec88dd0d0 (diff)
downloadarchangel-1a900e50433b0fcd3a192eed1c7989233a6928cf.tar.gz
archangel-1a900e50433b0fcd3a192eed1c7989233a6928cf.zip
feat(install): optional SWAP_SIZE carves a swap partition for hibernate
Hibernate needs a resume target outside the pool (swap-on-zvol deadlocks, a long-standing OpenZFS issue), and that's only decidable at partition time. SWAP_SIZE=100G in a config file carves partition 3 (type 8200) physically between EFI and root. Root still takes the remainder and the EFI=1/ROOT=2 numbering contract holds. validate_config rejects malformed sizes and multi-disk layouts. get_swap_partition handles nvme vs sata naming. This only partitions: formatting, encryption, and the resume chain stay manual for now. The change ran the real velox reinstall on 2026-08-13 (EFI=512M, SWAP=100G, ROOT=remainder).
Diffstat (limited to 'installer/lib/config.sh')
-rw-r--r--installer/lib/config.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/installer/lib/config.sh b/installer/lib/config.sh
index ed54e36..dea65a0 100644
--- a/installer/lib/config.sh
+++ b/installer/lib/config.sh
@@ -17,6 +17,10 @@ LOCALE="en_US.UTF-8"
KEYMAP="us"
ENABLE_SSH="yes" # SSH with root login (default yes for headless)
NO_ENCRYPT="no" # Skip filesystem encryption (testing only)
+SWAP_SIZE="" # Optional swap partition (e.g. "100G") — carved
+ # between EFI and root so hibernate has a resume
+ # target outside the pool. Single-disk only; empty
+ # keeps the original two-partition layout.
# Required fields — installer errors out if any are still empty at install time.
HOSTNAME=""
@@ -142,6 +146,19 @@ validate_config() {
((++errors))
fi
+ # SWAP_SIZE: sgdisk size syntax (digits + K/M/G/T), single disk only —
+ # a per-disk swap on a RAID layout has no defined resume device.
+ if [[ -n "$SWAP_SIZE" ]]; then
+ if [[ ! "$SWAP_SIZE" =~ ^[0-9]+[KMGT]$ ]]; then
+ warn "Invalid SWAP_SIZE '$SWAP_SIZE' (expected e.g. 100G)"
+ ((++errors))
+ fi
+ if [[ ${#SELECTED_DISKS[@]} -gt 1 ]]; then
+ warn "SWAP_SIZE is only supported on single-disk installs"
+ ((++errors))
+ fi
+ fi
+
if [[ $errors -gt 0 ]]; then
error "Config validation failed with $errors error(s)"
fi