From 53c5d48d723201010c0324bd10c7abafa0bce9af Mon Sep 17 00:00:00 2001 From: d3v1l0n Date: Tue, 24 Dec 2024 02:49:58 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf:=20check=20necessary?= =?UTF-8?q?=20permission=20and=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snigdhaos-libs/check-snapshot-boot | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/snigdhaos-libs/check-snapshot-boot b/snigdhaos-libs/check-snapshot-boot index e52e3efa..b55aadd0 100755 --- a/snigdhaos-libs/check-snapshot-boot +++ b/snigdhaos-libs/check-snapshot-boot @@ -1,6 +1,14 @@ #!/bin/bash -if grep -qE 'subvol=@/.snapshots/[0-9]+/snapshot' /proc/cmdline; then - exit 0 +if [[ -f /proc/cmdline ]]; then + 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 + echo "/proc/cmdline not found." + exit 2 fi -exit 1