]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
grub-btrfsd: Use generic volume_fs_type function for FS detection
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 27 Mar 2024 05:05:52 +0000 (06:05 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 27 Mar 2024 05:05:52 +0000 (06:05 +0100)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
src/initscripts/system/grub-btrfsd

index dc5e32ad47125cd843a721e06250e65564a7f815..90582b1b1150c4d75e50ce8c7c5f24cd4c369a24 100644 (file)
 SNAPSHOTDIR="/.snapshots"
 PIDFILE="/run/grub-btrfsd.pid"
 
-root_is_btrfs() {
-    [ "$(stat -f --format="%T" /)" == "btrfs" ] || return 1
-
-    return 0
-}
-
 case "$1" in
         start)
-               root_is_btrfs || exit 0
+               root_fs_type=$(volume_fs_type "/")
 
-               boot_mesg "Starting Grub/Btrfs snapshot manager..."
-               loadproc -b -p "$PIDFILE" /usr/bin/grub-btrfsd --syslog "$SNAPSHOTDIR"
+               case "$root_fs_type" in
+                       btrfs)
 
-               # Store the gained PID to the defined pidfile
-               echo "$!" > "$PIDFILE"
+                               boot_mesg "Starting Grub/Btrfs snapshot manager..."
+                               loadproc -b -p "$PIDFILE" /usr/bin/grub-btrfsd --syslog "$SNAPSHOTDIR"
+                               echo "$!" > "$PIDFILE"
+                       ;;
+               esac
        ;;
 
        stop)