Skip to contentSkip to conversation

Change check for udev on install.sh and check_hotplug

PATCH Murillo Fernandes Bernardes 2 participants 3 messages Nov 18, 2005

lore
Share & tools
lore
#0 lore raw

Changes check for "udev", so that it works on debian sid (that does not have /sbin/udev anymore).

Signature · 1 line
Murillo Fernandes Bernardes

# HG changeset patch
# User [email protected]
# Node ID 54911570fae54eda445880eb7bf31926964717dd
# Parent 9bf6f907b3ff0261902f06d261f76c1bd12af9f5
Changes check for "udev", so that it works on debian (that does not have /sbin/udev anymore).

Tested on Debian Sid and FC4.

install.sh +4 -1
diff -r 9bf6f907b3ff -r 54911570fae5 install.sh
@@ -27,7 +27,10 @@
 cp -fdRL $src/etc/init.d/* $dst/etc/init.d/
 echo "All done."
 
-if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then
+
+UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
+
+if [ -x /sbin/udevd ] && [ ! -z $UDEV_VERSION ] && [ $UDEV_VERSION -ge 059 ]; then
   cp -f $src/etc/udev/rules.d/*.rules $dst/etc/udev/rules.d/
 else
   cp -f $src/etc/hotplug/*.agent $dst/etc/hotplug/
tools/check/check_hotplug +3 -1
diff -r 9bf6f907b3ff -r 54911570fae5 tools/check/check_hotplug
@@ -7,7 +7,9 @@
    exit 1
 }
 
-if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then
+UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
+
+if [ -x /sbin/udevd ] && [ ! -z $UDEV_VERSION ] && [ $UDEV_VERSION -ge 059 ]; then
   exit 0
 fi
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 35 lines · Murillo Fernandes Bernardes

Changes check for "udev", so that it works on debian sid (that does not have /sbin/udev anymore).

Signature · 11 lines
Murillo Fernandes Bernardes

# HG changeset patch
# User [email protected]
# Node ID 54911570fae54eda445880eb7bf31926964717dd
# Parent  9bf6f907b3ff0261902f06d261f76c1bd12af9f5
Changes check for "udev", so that it works on debian (that does not have /sbin/udev anymore).

Tested on Debian Sid and FC4.

diff -r 9bf6f907b3ff -r 54911570fae5 install.sh
install.sh +4 -1
@@ -27,7 +27,10 @@
 cp -fdRL $src/etc/init.d/* $dst/etc/init.d/
 echo "All done."
 
-if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then
+
+UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
+
+if [ -x /sbin/udevd ] && [ ! -z $UDEV_VERSION ] && [ $UDEV_VERSION -ge 059 ]; then
   cp -f $src/etc/udev/rules.d/*.rules $dst/etc/udev/rules.d/
 else
   cp -f $src/etc/hotplug/*.agent $dst/etc/hotplug/

diff -r 9bf6f907b3ff -r 54911570fae5 tools/check/check_hotplug

tools/check/check_hotplug line 14

Quoted 9 lines
tools/check/check_hotplug +3 -1
@@ -7,7 +7,9 @@
    exit 1
 }
 
-if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then
+UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
+
+if [ -x /sbin/udevd ] && [ ! -z $UDEV_VERSION ] && [ $UDEV_VERSION -ge 059 ]; then
   exit 0
 fi

Isn't this going to issue a "udevinfo: command not found" message if udev isn't installed? It would be better if you checked for the existence of udevinfo before trying to run it.

Ewan.

#2 lore raw
Quoted 10 lines · Ewan Mellor
Quoted 4 lines · Murillo Fernandes Bernardes

Changes check for "udev", so that it works on debian sid (that does not have /sbin/udev anymore).

Isn't this going to issue a "udevinfo: command not found" message if udev isn't installed?
It would be better if you checked for the existence of udevinfo before trying to run it.

fixed in this patch.

Signature · 1 line
Murillo Fernandes Bernardes
install.sh +4 -1
diff -r f6fdb6e0d3c9 install.sh
@@ -27,7 +27,10 @@
 cp -fdRL $src/etc/init.d/* $dst/etc/init.d/
 echo "All done."
 
-if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then
+[ -x "$(which udevinfo)" ] && \
+  UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
+
+if [ -n "$UDEV_VERSION" ] && [ $UDEV_VERSION -ge 059 ]; then
   cp -f $src/etc/udev/rules.d/*.rules $dst/etc/udev/rules.d/
 else
   cp -f $src/etc/hotplug/*.agent $dst/etc/hotplug/
tools/check/check_hotplug +3 -1
diff -r f6fdb6e0d3c9 tools/check/check_hotplug
@@ -6,8 +6,10 @@
    echo '  *** Check for the hotplug scripts (hotplug) FAILED'
    exit 1
 }
+[ -x "$(which udevinfo)" ] && \
+  UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
 
-if [ -x /sbin/udev ] && [ ! -z `/sbin/udev -V` ] && [ `/sbin/udev -V` -ge 059 ]; then
+if [ -n "$UDEV_VERSION" ] && [ $UDEV_VERSION -ge 059 ]; then
   exit 0
 fi
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel