status: fix false DRIFT for non-root invocations

- runner: export sbin-inclusive PATH (util-linux tools live in /usr/sbin)
- 001: read /proc/swaps instead of swapon(8)
- 005: resolve /dev/disk/by-uuid symlink instead of findfs(8); report ?
  (exit 2) when the UUID cannot be resolved
This commit is contained in:
wan
2026-08-31 16:48:06 +09:00
parent 5d1f641c61
commit 84d6f9724c
3 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -32,7 +32,8 @@ case "${1:-}" in
;;
status)
src=$(findmnt -rn -o SOURCE "$MOUNTPOINT" 2>/dev/null || true)
want=$(findfs UUID="$DISK_UUID" 2>/dev/null || true)
want=$(readlink -f "/dev/disk/by-uuid/$DISK_UUID" 2>/dev/null || true)
[[ -n $want ]] || { echo "? cannot resolve UUID=$DISK_UUID"; exit 2; }
[[ -n $src ]] || { echo "DRIFT $MOUNTPOINT not mounted"; exit 1; }
[[ $src == "$want" ]] || { echo "DRIFT $MOUNTPOINT mounted from $src (want $want)"; exit 1; }
grep -q "^UUID=$DISK_UUID $MOUNTPOINT " /etc/fstab \