Files
snigdhaos-pkgbuilds/snigdhaos-libs/check-snapshot-boot

18 lines
453 B
Bash
Executable File

#!/bin/bash
# Check if /proc/cmdline exists
if [[ -f /proc/cmdline ]]; then
# Check if booting from a Btrfs snapshot
if grep -qE 'subvol=@/.snapshots/[0-9]+/snapshot' /proc/cmdline; then
echo "Booting from a Btrfs snapshot."
exit 0
else
echo "Not booting from a Btrfs snapshot."
exit 1
fi
else
# Handle the case where /proc/cmdline is missing
echo "Error: /proc/cmdline not found."
exit 2
fi