]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
90btrfs: add btrfs device with multiple components
authorHarald Hoyer <harald@redhat.com>
Thu, 11 Aug 2011 14:56:52 +0000 (16:56 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 11 Aug 2011 15:52:40 +0000 (17:52 +0200)
modules.d/90btrfs/80-btrfs.rules
modules.d/90btrfs/btrfs_finished.sh [new file with mode: 0755]
modules.d/90btrfs/btrfs_timeout.sh [new file with mode: 0755]
modules.d/90btrfs/module-setup.sh

index 7c98d986d32ab7621e9a75ce306cdd8858505bc3..e74f9a6af647e465d9367e95b37aef2e57ddfdbe 100644 (file)
@@ -1,8 +1,11 @@
 SUBSYSTEM!="block", GOTO="btrfs_end"
 ACTION!="add|change", GOTO="btrfs_end"
+ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
+RUN+="/sbin/modprobe btrfs"
+RUN+="/sbin/btrfs device scan $env{DEVNAME}"
 
-ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/modprobe btrfs"
-ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/btrfs device scan $env{DEVNAME}"
+RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
+RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
 
 LABEL="btrfs_end"
 
diff --git a/modules.d/90btrfs/btrfs_finished.sh b/modules.d/90btrfs/btrfs_finished.sh
new file mode 100755 (executable)
index 0000000..3601279
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+if [ -e /dev/root ]; then
+   if strstr "$(udevadm info --query=env --name=/dev/root)" "ID_FS_TYPE=btrfs"; then
+      info "Checking, if btrfs device complete"
+      unset __btrfs_mount
+      mount -o ro /dev/root /tmp >/dev/null 2>&1
+      __btrfs_mount=$?
+      [ $__btrfs_mount -eq 0 ] && umount /dev/root >/dev/null 2>&1
+      exit $__btrfs_mount
+   fi
+fi
+
+exit 0
diff --git a/modules.d/90btrfs/btrfs_timeout.sh b/modules.d/90btrfs/btrfs_timeout.sh
new file mode 100755 (executable)
index 0000000..84f7997
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+info "Scanning for all btrfs devices"
+/sbin/btrfs device scan 2>&1 | vinfo
+exit 0
index c5ea6bf04bb4af778218395c3f2b1f4ba71f5e7a..7b0b4247ef22a87fab35eb9f1203cffe87dab30e 100755 (executable)
@@ -34,6 +34,8 @@ installkernel() {
 
 install() {
     inst_rules "$moddir/80-btrfs.rules"
-    dracut_install btrfs
+    inst "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
+    inst "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
+    dracut_install btrfs btrfsck
 }