]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
btrfs: add hostonly check
authorHarald Hoyer <harald@redhat.com>
Wed, 21 Jul 2010 12:25:42 +0000 (14:25 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 21 Jul 2010 12:31:13 +0000 (14:31 +0200)
modules.d/90btrfs/check

index 532e2ef4dea99b2f8585baafff6440706ade8fc3..99aa712547b8247137c7b897afb0a8a403468c73 100755 (executable)
@@ -1,10 +1,22 @@
 #!/bin/bash
 
 # We depend on udev-rules being loaded
-[ "$1" = "-d" ] && exit 0
+[[ "$1" = "-d" ]] && exit 0
 
 # if we don't have btrfs (btrfsctl) installed on the host system,
 # no point in trying to support it in the initramfs.
 which btrfsctl >/dev/null 2>&1 || exit 1
 
+. $dracutfunctions
+[[ $debug ]] && set -x
+
+is_btrfs() { get_fs_type /dev/block/$1 |grep -q btrfs; }
+
+if [[ "$1" = "-h" ]]; then
+    rootdev=$(find_root_block_device)
+    if [[ $rootdev ]]; then
+       is_btrfs "$rootdev" || exit 1
+    fi
+fi
+
 exit 0