Skip to contentSkip to conversation

Linux/init: add udev and brctl checks to xencommons

PATCH In review Roger Pau Monne 2 participants 6 messages Feb 21, 2012 – Feb 24, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Linux/init: add udev and brctl checks to xencommons

Move udev and brctl checks previously in tools/check to xencommons.

#1 lore raw

PATCH 1/1 Linux/init: check for brctl at xencommons

# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1329811412 -3600
# Node ID 40f8487cacc807bb6f9d642b4fe75deaf1087833 # Parent c157f98ab8ff6e2e8b35cc6135f636896cb4f623 Linux/init: check for brctl at xencommons

Check for brctl at xencommons, since hotplug scripts use it.

tools/hotplug/Linux/init.d/xencommons +3 -0
diff -r c157f98ab8ff -r 40f8487cacc8 tools/hotplug/Linux/init.d/xencommons
@@ -50,6 +50,9 @@ if test -f /proc/xen/capabilities && \
 	exit 0
 fi
 
+# Check if brctl is present
+hash brctl > /dev/null 2>&1 || echo "Warning: brctl not found"
+
 do_start () {
         local time=0
 	local timeout=30
#2 lore raw

Re: [PATCH 1 of 2] Linux/init: check for brctl at xencommons

Roger Pau Monne writes ("[PATCH 1 of 2] Linux/init: check for brctl at xencommons"):

Quoted 1 line

Linux/init: check for brctl at xencommons

...

tools/hotplug/Linux/init.d/xencommons if test -f /proc/xen/capabilities && \ · line 54

Quoted 2 lines
tools/hotplug/Linux/init.d/xencommons +2 -0
+# Check if brctl is present
+hash brctl > /dev/null 2>&1 || echo "Warning: brctl not found"

I using think "type" would be more idomatic than "hash".

I think the warning message should go to stderr and mention xencommons. I was going to suggest that you should use the lsb init function "log_warning_msg" but I see that xencommons does not currently source /lib/lsb/init-functions. But perhaps it should.

http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html

Ian.

#3 lore raw

Re: [PATCH 1 of 2] Linux/init: check for brctl at xencommons

2012/2/24 Ian Jackson <[email protected]>:

Quoted 5 lines

Roger Pau Monne writes ("[PATCH 1 of 2] Linux/init: check for brctl at xencommons"):

Quoted 1 line

Linux/init: check for brctl at xencommons

...

tools/hotplug/Linux/init.d/xencommons if test -f /proc/xen/capabilities && \ · line 54

Quoted 2 lines
tools/hotplug/Linux/init.d/xencommons +2 -0
+# Check if brctl is present
+hash brctl > /dev/null 2>&1 || echo "Warning: brctl not found"

(this is a previous version of the patch, see
http://lists.xen.org/archives/html/xen-devel/2012-02/msg02108.html for the new series)

Quoted 1 line

I using think "type" would be more idomatic than "hash".

Ok, I will replace hash with type

Quoted 4 lines

I think the warning message should go to stderr and mention xencommons.  I was going to suggest that you should use the lsb init function "log_warning_msg" but I see that xencommons does not currently source /lib/lsb/init-functions.  But perhaps it should.

I usually use OpenRC under Linux, and since it doesn't like the stock xencommons file I use a custom one. If you think it is ok to include /lib/lsb/init-functions I can update the series to include that and make use of log_warning_msg.

Quoted 3 lines

http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html

Ian.

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

#4 lore raw

PATCH 1/1 Linux/init: check for udev >= 59 at xencommons

In reply to Roger Pau Monne

# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1329814249 -3600
# Node ID eea0d53efff1fa94266026088cd5498921598df6 # Parent 40f8487cacc807bb6f9d642b4fe75deaf1087833 Linux/init: check for udev >= 59 at xencommons

Check for udev at xencommons, since hotplug scripts use it.

tools/hotplug/Linux/init.d/xencommons +20 -0
diff -r 40f8487cacc8 -r eea0d53efff1 tools/hotplug/Linux/init.d/xencommons
@@ -53,6 +53,26 @@ fi
 # Check if brctl is present
 hash brctl > /dev/null 2>&1 || echo "Warning: brctl not found"
 
+# Check for udev >= 59
+if ! hash udevadm > /dev/null 2>&1
+then
+	if ! hash udevinfo > /dev/null 2>&1
+	then
+		echo "Warning: unable to find udevadm or udevinfo"
+	else
+		udevver=`udevinfo -V | awk '{print $NF}'`
+	fi
+else
+	udevver=`udevadm info -V | awk '{print $NF}'`
+fi
+if test -z "${udevver}" || test "${udevver}" -lt 59
+then
+	if ! hash hotplug > /dev/null 2>&1
+	then
+		echo "Warning: udev is too old, upgrade to version 59 or later"
+	fi
+fi
+
 do_start () {
         local time=0
 	local timeout=30