summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/libvirt/libvirt.SlackBuild2
-rw-r--r--libraries/libvirt/rc.libvirt30
2 files changed, 16 insertions, 16 deletions
diff --git a/libraries/libvirt/libvirt.SlackBuild b/libraries/libvirt/libvirt.SlackBuild
index c8a17ffd6c..aee62631a4 100644
--- a/libraries/libvirt/libvirt.SlackBuild
+++ b/libraries/libvirt/libvirt.SlackBuild
@@ -6,7 +6,7 @@
PRGNAM=libvirt
VERSION=${VERSION:-1.2.11}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
diff --git a/libraries/libvirt/rc.libvirt b/libraries/libvirt/rc.libvirt
index d8ddd63faa..19bf66567e 100644
--- a/libraries/libvirt/rc.libvirt
+++ b/libraries/libvirt/rc.libvirt
@@ -18,31 +18,31 @@ OPTS=${OPTS:-" -v -f /etc/libvirt/libvirtd.conf -p $PIDFILE "}
check_running_machines() {
- i=0
+ count=0
- for j in `/usr/sbin/virsh list | grep running | awk '{print $2;}'` ; do
- /usr/sbin/virsh shutdown $j
+ for machine in $(virsh list --name --state-running | grep -v ^$) ; do
+ /usr/sbin/virsh shutdown $machine
done
echo -n "Waiting machines"
- while [ $(/usr/sbin/virsh list | grep running | wc -l) -gt "0" ]; do
- if [ "$i" -ge "$TIMEOUT" ];then
+ while [ $(virsh list --name --state-running | grep -v ^$ | wc -l) -gt "0" ]; do
+ if [ "$count" -ge "$TIMEOUT" ];then
break
fi
echo -n "."
- i=`expr $i + 1`
+ count=$(expr $count + 1)
sleep 1
done
echo ""
- if [ $(/usr/sbin/virsh list | grep running | wc -l) -gt "0" ];then
+ if [ $(virsh list --name --state-running | grep -v ^$ | wc -l) -gt "0" ];then
echo -n "The following machines are still running, forcing shutdown: "
- for j in `/usr/sbin/virsh list | grep running | awk '{print $2;}'` ; do
- /usr/sbin/virsh destroy $j
- echo -n "$j "
+ for machine in $(virsh list --name --state-running | grep -v ^$) ; do
+ /usr/sbin/virsh destroy $machine
+ echo -n "$machine "
done
echo ""
@@ -67,10 +67,10 @@ check_processor() {
MODULES="$MODULES kvm_amd kvm"
fi
- check=`expr $check + $?`
+ check=$(expr $check + $?)
if [ $check -eq "2" ];then
- echo "Your systems does not support KVM!"
+ echo "Your system does not support KVM!"
fi
}
@@ -95,10 +95,10 @@ stop() {
check_running_machines
check_processor
echo "Stopping libvirtd..."
- for i in $(/usr/sbin/virsh net-list | tail -n +3 | awk '{print $1}'); do
- /usr/sbin/virsh net-destroy "$i"
+ for network in $(/usr/sbin/virsh net-list | tail -n +3 | awk '{print $1}'); do
+ /usr/sbin/virsh net-destroy "$network"
done
- kill -TERM `cat $PIDFILE`
+ kill -TERM $(cat $PIDFILE)
sleep 3
/sbin/modprobe -ra $MODULES 2>/dev/null
}