prepare udev rules for udev >= 143
authorHarald Hoyer <harald@redhat.com>
Fri, 19 Jun 2009 06:58:15 +0000 (08:58 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 19 Jun 2009 07:29:16 +0000 (09:29 +0200)
modules.d/90crypt/70-luks.rules [moved from modules.d/90crypt/63-luks.rules with 100% similarity]
modules.d/90crypt/install
modules.d/90lvm/64-lvm-vol_id.rules [new file with mode: 0644]
modules.d/90lvm/64-lvm.rules
modules.d/90lvm/install
modules.d/90mdraid/65-md-incremental.rules [new file with mode: 0644]
modules.d/90mdraid/install
modules.d/95nbd/61-nbd-vol_id.rules [new file with mode: 0644]
modules.d/95nbd/61-nbd.rules
modules.d/95nbd/install
modules.d/95udev-rules/install

index fcaaa60..a3a856d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
 inst cryptsetup
 instmods dm_crypt cbc aes sha256 xts
-inst_rules "$moddir/63-luks.rules"
+inst_rules "$moddir/70-luks.rules"
 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
diff --git a/modules.d/90lvm/64-lvm-vol_id.rules b/modules.d/90lvm/64-lvm-vol_id.rules
new file mode 100644 (file)
index 0000000..d4b5269
--- /dev/null
@@ -0,0 +1,20 @@
+# hacky rules to try to activate lvm when we get new block devs...
+#
+# Copyright 2008, Red Hat, Inc.
+# Jeremy Katz <katzj@redhat.com>
+
+
+SUBSYSTEM!="block", GOTO="lvm_end"
+ACTION!="add|change", GOTO="lvm_end"
+KERNEL!="dm-*", GOTO="lvm_end"
+
+IMPORT{program}="vol_id --export $tempnode"
+
+ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
+
+OPTIONS="link_priority=-100"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+
+LABEL="lvm_end"
index 8a2fcc4..3eddd07 100644 (file)
@@ -6,8 +6,15 @@
 
 SUBSYSTEM!="block", GOTO="lvm_end"
 ACTION!="add|change", GOTO="lvm_end"
+KERNEL!="dm-*", GOTO="lvm_end"
+
+IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
 
-KERNEL=="dm-[0-9]*", IMPORT{program}="vol_id --export $tempnode"
 ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
 
+OPTIONS="link_priority=-100"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+
 LABEL="lvm_end"
index d32748b..48f6ec7 100755 (executable)
@@ -1,3 +1,7 @@
 #!/bin/bash
 inst lvm
-inst_rules "$moddir/64-lvm.rules" 64-device-mapper.rules
\ No newline at end of file
+if [ -x /lib/udev/vol_id ]; then
+    inst_rules "$moddir/64-lvm-vol_id.rules" 64-device-mapper.rules
+else
+    inst_rules "$moddir/64-lvm.rules" 64-device-mapper.rules
+fi
diff --git a/modules.d/90mdraid/65-md-incremental.rules b/modules.d/90mdraid/65-md-incremental.rules
new file mode 100644 (file)
index 0000000..3dec8df
--- /dev/null
@@ -0,0 +1,8 @@
+# This file causes block devices with Linux RAID (mdadm) signatures to
+# automatically cause mdadm to be run.
+# See udev(8) for syntax
+
+SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
+       IMPORT{program}="/sbin/mdadm --examine --export $tempnode", \
+       RUN+="/bin/bash -c '[ ! -f /dev/.in_sysinit ] && /sbin/mdadm -I $env{DEVNAME}'"
+
index a6fad0d..9b69941 100755 (executable)
@@ -3,7 +3,14 @@ dracut_install mdadm
 inst /etc/passwd
 inst /etc/group
 instmods =drivers/md
-inst_rules "$moddir/61-mdadm.rules"
+
+if [ -x /lib/udev/vol_id ]; then
+    inst_rules "$moddir/61-mdadm.rules"
+else
+    inst_rules "$moddir/65-md-incremental.rules"
+    inst_rules 64-md-raid.rules
+fi
+
 [ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
 [ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf
 if [ -x  /sbin/mdmon ] ; then
diff --git a/modules.d/95nbd/61-nbd-vol_id.rules b/modules.d/95nbd/61-nbd-vol_id.rules
new file mode 100644 (file)
index 0000000..67c2fb2
--- /dev/null
@@ -0,0 +1,7 @@
+SUBSYSTEM!="block", GOTO="nbd_end"
+ACTION!="change", GOTO="nbd_end"
+
+KERNEL=="nbd[0-9]*", IMPORT{program}="vol_id --export $tempnode"
+KERNEL=="nbd[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
+
+LABEL="nbd_end"
index 5892cf3..f8c9509 100644 (file)
@@ -1,6 +1,6 @@
 SUBSYSTEM!="block", GOTO="nbd_end"
-ACTION!="add|change", GOTO="nbd_end"
+ACTION!="change", GOTO="nbd_end"
 
-KERNEL=="nbd*", IMPORT{program}="vol_id --export $tempnode"
+KERNEL=="nbd[0-9]*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
 
 LABEL="nbd_end"
index dace08f..76091a1 100755 (executable)
@@ -2,6 +2,12 @@
 
 inst nbd-client
 inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
-inst_rules "$moddir/61-nbd.rules"
+
+if [ -x /lib/udev/vol_id ]; then
+    inst_rules "$moddir/61-nbd-vol_id.rules"
+else
+    inst_rules "$moddir/61-nbd.rules"
+fi
+
 inst "$moddir/nbdroot" "/sbin/nbdroot"
 instmods nbd
index c5d73a6..d55c61a 100755 (executable)
@@ -8,7 +8,11 @@ inst_rules 50-udev-default.rules 60-persistent-storage.rules \
     61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules 
 #Some debian udev rules are named differently
 inst_rules 50-udev.rules 95-late.rules
+
+if [ ! -x /lib/udev/vol_id ]; then
+    dracut_install blkid
+fi
+
 if ldd $(find_binary udevd) |grep -q /lib64/libc; then
     dracut_install /lib64/libnss_files*
 else