[Pkg-xen-devel] [PATCH 02/13] xen init script: silently exit status 0 if not running under xen

Hans van Kranenburg hans at knorrie.org
Sun Feb 10 23:42:00 GMT 2019


From: Ian Jackson <ian.jackson at citrix.com>

This script should not complain at all if we are not running under
Xen.  Check this right at the start.

This will enable improvements to the following code, which will no
longer have to deal with the `not running under Xen' case.

Signed-off-by: Ian Jackson <ian.jackson at citrix.com>
---
 debian/xen-utils-common.xen.init | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/debian/xen-utils-common.xen.init b/debian/xen-utils-common.xen.init
index 4b793d5ac2..da7d361453 100644
--- a/debian/xen-utils-common.xen.init
+++ b/debian/xen-utils-common.xen.init
@@ -20,6 +20,10 @@ XENSTORED_DIR="/var/run/xenstored"
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 DESC="Xen daemons"
 
+case "$(cat /sys/hypervisor/type 2>/dev/null)" in
+xen)		;;
+*)	exit 0	;; # not running under Xen
+esac
 ROOT=$(/usr/lib/xen-common/bin/xen-dir 2>/dev/null)
 if [ $? -ne 0 ]; then
 	log_warning_msg "Not running within Xen or no compatible utils"
-- 
2.20.1




More information about the Pkg-xen-devel mailing list