#!/usr/bin/env bash # ───────────────────────────────────────────────────────────────────────────── # Arcline OS — write a real /etc/fstab from an edition template # # scripts/apply-fstab.sh [efi-uuid] # # Renders editions//fstab with the real root partition UUID, drops # the template's swapfile line (no swap is created during deploy), and — in # EFI installs — appends the EFI system partition mount. # ───────────────────────────────────────────────────────────────────────────── set -euo pipefail source "$(dirname "${BASH_SOURCE[0]}")/common.sh" TARGET="${1:?usage: apply-fstab.sh [efi-uuid]}" EDITION="${2:?usage: apply-fstab.sh [efi-uuid]}" ROOT_UUID="${3:?usage: apply-fstab.sh [efi-uuid]}" EFI_UUID="${4:-}" validate_edition "$EDITION" [[ -d "$TARGET" ]] || die "target '$TARGET' does not exist" EDIR="$(edition_dir "$EDITION")" tmp="$(mktemp)" trap 'rm -f "$tmp" "$tmp.clean"' EXIT # template → real fstab; remove the swapfile line + its comment (no swap created on deploy) sed "s/__ROOT_UUID__/$ROOT_UUID/g" "$EDIR/fstab" | grep -v -E '(swapfile|^[[:space:]]*#.*swap)' > "$tmp.clean" if [[ -n "$EFI_UUID" ]]; then printf 'UUID=%s /boot/efi vfat umask=0077 0 1\n' "$EFI_UUID" >> "$tmp.clean" fi install -Dm0644 "$tmp.clean" "$TARGET/etc/fstab" log "wrote $TARGET/etc/fstab (root UUID $ROOT_UUID${EFI_UUID:+, efi UUID $EFI_UUID})"