add environment variables for different udev versions
authorHarald Hoyer <harald@redhat.com>
Mon, 13 Jul 2009 11:51:33 +0000 (13:51 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 13 Jul 2009 13:03:11 +0000 (15:03 +0200)
modules.d/90dmraid/dmraid.sh
modules.d/99base/init

index fcd75f7..4a14722 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-if udevadm settle --timeout=1 >/dev/null 2>&1; then
+if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
     [ -h "$job" ] && rm -f "$job"
     # run dmraid if udev has settled
     dmraid -ay -Z
index bced5b2..ea2f4c2 100755 (executable)
@@ -82,8 +82,17 @@ source_all pre-udev
 
 # start up udev and trigger cold plugs
 udevd --daemon
-getarg rdudevinfo && udevadm control --log_priority=info
-getarg rdudevdebug && udevadm control --log_priority=debug
+
+UDEV_LOG_PRIO_ARG=--log-priority
+UDEV_QUEUE_EMPTY="udevadm settle --timeout=0"
+
+if [ $UDEVVERSION -lt 140 ]; then
+   UDEV_LOG_PRIO_ARG=--log_priority
+   UDEV_QUEUE_EMPTY="udevadm settle --timeout=1"
+fi
+
+getarg rdudevinfo && udevadm control $UDEV_LOG_PRIO_ARG=info
+getarg rdudevdebug && udevadm control $UDEV_LOG_PRIO_ARG=debug
 
 source_all pre-trigger
 
@@ -127,7 +136,7 @@ while :; do
 
     [ -n "$queuetriggered" ] && continue
 
-    if udevadm settle --timeout=1 >/dev/null 2>&1; then
+    if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
         # no more udev jobs
         sleep 0.5
         i=$(($i+1))