]> git.ipfire.org Git - people/ms/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 19:39:18 +0000 (20:39 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Tue, 2 Apr 2024 19:25:15 +0000 (19:25 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@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)