[xen] make xendomains systemd script executable and update it from init.d version

myoung myoung at fedoraproject.org
Thu Apr 4 17:40:05 UTC 2013


commit 3f8fcdedb0a07d169fbebda388f5b0544ea86a59
Author: Michael Young <m.a.young at durham.ac.uk>
Date:   Thu Apr 4 18:39:07 2013 +0100

    make xendomains systemd script executable and update it from init.d version

 libexec.xendomains |   23 ++++++++++++++---------
 xen.spec           |    7 +++++--
 2 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/libexec.xendomains b/libexec.xendomains
index d908948..4c6fffc 100755
--- a/libexec.xendomains
+++ b/libexec.xendomains
@@ -190,15 +190,20 @@ rdnames()
     done
 }
 
+LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
 parseln()
 {
-    if [[ "$1" =~ '(domain' ]]; then
+    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
         name=;id=
-    else if [[ "$1" =~ '(name' ]]; then
+    elif [[ "$1" =~ '(name' ]]; then
         name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
-    else if [[ "$1" =~ '(domid' ]]; then
+    elif [[ "$1" =~ '(domid' ]]; then
         id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
-    fi; fi; fi
+    elif [[ "$1" =~ '"name":' ]]; then
+        name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/')
+    elif [[ "$1" =~ '"domid":' ]]; then
+        id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/')
+    fi
 
     [ -n "$name" -a -n "$id" ] && return 0 || return 1
 }
@@ -216,7 +221,7 @@ is_running()
 		RC=0
 		;;
 	esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return $RC
 }
 
@@ -298,7 +303,7 @@ all_zombies()
 	if test "$state" != "-b---d" -a "$state" != "-----d"; then
 	    return 1;
 	fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return 0
 }
 
@@ -421,7 +426,7 @@ stop()
 	    echo -n "(shut)"
 	    watchdog_xencmd shutdown &
 	    WDOG_PID=$!
-	    XMR=`$CMD shutdown $id $XENDOMAINS_SHUTDOWN 2>&1 1>/dev/null`
+	    XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN $id 2>&1 1>/dev/null`
 	    if test $? -ne 0; then
 		echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
 		rc_failed $?
@@ -429,7 +434,7 @@ stop()
 	    fi
 	    kill $WDOG_PID >/dev/null 2>&1
 	fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -466,7 +471,7 @@ check_domain_up()
 		return 0
 		;;
 	esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep $LIST_GREP)
     return 1
 }
 
diff --git a/xen.spec b/xen.spec
index 55c633b..345403a 100644
--- a/xen.spec
+++ b/xen.spec
@@ -27,7 +27,7 @@
 Summary: Xen is a virtual machine monitor
 Name:    xen
 Version: 4.2.1
-Release: 9%{?dist}
+Release: 10%{?dist}
 Group:   Development/Libraries
 License: GPLv2+ and LGPLv2+ and BSD
 URL:     http://xen.org/
@@ -393,7 +393,7 @@ install -m 644 %{SOURCE45} %{buildroot}%{_unitdir}/xenconsoled.service
 install -m 644 %{SOURCE46} %{buildroot}%{_unitdir}/xen-watchdog.service
 install -m 644 %{SOURCE47} %{buildroot}%{_unitdir}/xendomains.service
 mkdir -p %{buildroot}%{_libexecdir}
-install -m 644 %{SOURCE48} %{buildroot}%{_libexecdir}/xendomains
+install -m 755 %{SOURCE48} %{buildroot}%{_libexecdir}/xendomains
 mkdir -p %{buildroot}/usr/lib/tmpfiles.d
 install -m 644 %{SOURCE49} %{buildroot}/usr/lib/tmpfiles.d/xen.conf
 %endif
@@ -747,6 +747,9 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
+* Thu Apr 04 2013 Michael Young <m.a.young at durham.ac.uk> - 4.2.1-10
+- make xendomains systemd script executable and update it from init.d version
+
 * Thu Feb 21 2013 Michael Young <m.a.young at durham.ac.uk> - 4.2.1-9
 - patch for [XSA-36, CVE-2013-0153] can cause boot time crash
 


More information about the scm-commits mailing list