Update configuration.nix

This commit is contained in:
ska
2025-12-22 16:05:18 +00:00
parent 5692709ea6
commit 7762d471db

View File

@@ -230,15 +230,21 @@
ROOT_SRC="$($FINDMNT -n -o SOURCE / || true)" ROOT_SRC="$($FINDMNT -n -o SOURCE / || true)"
[ -z "$ROOT_SRC" ] && exit 0 [ -z "$ROOT_SRC" ] && exit 0
DEV="$ROOT_SRC" # Resolve to top-level disk exactly once
while PARENT="$($LSBLK -no PKNAME "$DEV" 2>/dev/null)"; [ -n "$PARENT" ]; do PARENT="$($LSBLK -ndo PKNAME "$ROOT_SRC" 2>/dev/null || true)"
DEV="/dev/$PARENT" if [ -n "$PARENT" ]; then
done ROOT_DEV="/dev/$PARENT"
else
ROOT_DEV="$ROOT_SRC"
fi
DEV_NAME="$($BASENAME "$DEV")" DEV_NAME="$($BASENAME "$ROOT_DEV")"
# Sanity check: ensure device exists before watching
[ ! -e "/sys/class/block/$DEV_NAME" ] && exit 0
while [ -e "/sys/class/block/$DEV_NAME" ]; do while [ -e "/sys/class/block/$DEV_NAME" ]; do
$SLEEP 0.5 $SLEEP 1
done done
$SYSTEMCTL poweroff $SYSTEMCTL poweroff