From 5208389de723f2a8cd7bccbf9bb7ac1550e2e780 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 8 Dec 2011 16:50:16 +0000 Subject: [PATCH] tools: init.d/Linux/xencommons: run script only when needed Currently xencommons prints an error that /proc/xen/capabilities does not exist when started on a non-xen kernel. Update the xencommons script to run only when needed: - do not run if /proc/xen does not exist - check if /proc/xen/capabilities exists before doing the grep for dom0 Signed-off-by: Olaf Hering Acked-by: Ian Jackson Committed-by: Ian Jackson xen-unstable changeset: 24333:4002e63b188a Backport-requested-by: Olaf Hering Committed-by: Ian Jackson --- tools/hotplug/Linux/init.d/xencommons | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons index 26ab303279..1378bef0fa 100644 --- a/tools/hotplug/Linux/init.d/xencommons +++ b/tools/hotplug/Linux/init.d/xencommons @@ -29,15 +29,24 @@ test -f $xencommons_config/xencommons && . $xencommons_config/xencommons XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid shopt -s extglob +# not running in Xen dom0 or domU +if ! test -d /proc/xen ; then + exit 0 +fi + +# mount xenfs in dom0 or domU with a pv_ops kernel if test "x$1" = xstart && \ - test -d /proc/xen && \ ! test -f /proc/xen/capabilities && \ ! grep '^xenfs ' /proc/mounts >/dev/null; then mount -t xenfs xenfs /proc/xen fi -if ! grep -q "control_d" /proc/xen/capabilities ; then +# run this script only in dom0: +# no capabilities file in xenlinux domU kernel +# empty capabilities file in pv_ops domU kernel +if test -f /proc/xen/capabilities && \ + ! grep -q "control_d" /proc/xen/capabilities ; then exit 0 fi