aboutsummaryrefslogtreecommitdiff
path: root/libraries/libvirt
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/libvirt')
-rw-r--r--libraries/libvirt/README18
-rw-r--r--libraries/libvirt/doinst.sh1
-rw-r--r--libraries/libvirt/libvirt.SlackBuild60
-rw-r--r--libraries/libvirt/libvirt.info8
-rw-r--r--libraries/libvirt/rc.libvirt106
5 files changed, 187 insertions, 6 deletions
diff --git a/libraries/libvirt/README b/libraries/libvirt/README
index efc0370908f30..fe57c5e7bdc0d 100644
--- a/libraries/libvirt/README
+++ b/libraries/libvirt/README
@@ -2,3 +2,21 @@ libvirt - The virtualization API
libvirt is a toolkit to interact with the virtualization
capabilities of recent versions of Linux (and other OSes).
+
+You can enable other optional (not-autodetected) features
+by passing variables to the script
+(VAR=yes|no ./libvirt.SlackBuild):
+VIRTGROUP=somegroup (default: users) qemu group used
+XEN=yes|no (default: no) Xen support
+OPENVZ=yes|no (default: no) OpenVZ support
+VMWARE=yes|no (default: no) VMware support
+ESX=yes|no (default: no) ESX support
+VBOX=yes|no (default: no) VirtualBox support
+
+If you want to start the libvirt daemon at boot, add this
+to /etc/rc.d/rc.local
+
+# Start libvirt:
+if [ -x /etc/rc.d/rc.libvirt ]; then
+ /etc/rc.d/rc.libvirt start
+fi
diff --git a/libraries/libvirt/doinst.sh b/libraries/libvirt/doinst.sh
index a52368c97a339..55971730701a1 100644
--- a/libraries/libvirt/doinst.sh
+++ b/libraries/libvirt/doinst.sh
@@ -40,3 +40,4 @@ config etc/logrotate.d/libvirtd.qemu.new
config etc/logrotate.d/libvirtd.uml.new
config etc/sasl2/libvirt.conf.new
config etc/sysctl.d/libvirtd.new
+config etc/rc.d/rc.libvirt.new
diff --git a/libraries/libvirt/libvirt.SlackBuild b/libraries/libvirt/libvirt.SlackBuild
index ce7342dabba33..965edb9f9540a 100644
--- a/libraries/libvirt/libvirt.SlackBuild
+++ b/libraries/libvirt/libvirt.SlackBuild
@@ -4,7 +4,7 @@
# Written by Michal Bialozor <bialyy@o2.pl>
PRGNAM=libvirt
-VERSION=0.9.12
+VERSION=0.9.13
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -35,6 +35,40 @@ else
LIBDIRSUFFIX=""
fi
+PYTHONSITEPKG=$(python -c "import sys, os; print os.path.join('/usr/lib${LIBDIRSUFFIX}', 'python%s' % sys.version[:3], 'site-packages')")
+
+VIRTGROUP=${VIRTGROUP:-users}
+
+if [ "${OPENVZ:-no}" = "no" ]; then
+ enable_openvz="--without-openvz"
+else
+ enable_openvz="--with-openvz"
+fi
+
+if [ "${XEN:-no}" = "no" ]; then
+ enable_xen="--without-xen"
+else
+ enable_xen="--with-xen"
+fi
+
+if [ "${VMWARE:-no}" = "no" ]; then
+ enable_vmware="--without-vmware"
+else
+ enable_vmware="--with-vmware"
+fi
+
+if [ "${ESX:-no}" = "no" ]; then
+ enable_esx="--without-esx"
+else
+ enable_esx="--with-esx"
+fi
+
+if [ "${VBOX:-no}" = "no" ]; then
+ enable_vbox="--without-vbox"
+else
+ enable_vbox="--with-vbox"
+fi
+
set -e
rm -rf $PKG
@@ -58,7 +92,16 @@ CFLAGS="$SLKCFLAGS" \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--enable-static=no \
--enable-shared=yes \
- --without-xen \
+ --with-yajl \
+ --with-python=/usr \
+ --with-qemu-group=$VIRTGROUP \
+ $enable_xen \
+ $enable_openvz \
+ $enable_vmware \
+ $enable_esx \
+ $enable_vbox \
+ --with-init-script=none \
+ --without-hal \
--build=$ARCH-slackware-linux
make \
@@ -126,6 +169,19 @@ mv $PKG/etc/sasl2/libvirt.conf \
mv $PKG/etc/sysctl.d/libvirtd \
$PKG/etc/sysctl.d/libvirtd.new
+# add an rc.libvirt to start the daemon
+install -D -m 0755 $CWD/rc.libvirt $PKG/etc/rc.d/rc.libvirt.new
+
+# by default we got no certs
+sed -i -e 's|\#listen_tls\ =\ 0|listen_tls = 0|' $PKG/etc/libvirt/libvirtd.conf.new
+
+# we use $VIRTGROUP as our virtualization group
+sed -i -e "s|\#group\ =\ \"root\"|group = \"$VIRTGROUP\"|" $PKG/etc/libvirt/qemu.conf.new
+sed -i -e "s|\#unix_sock_group\ =\ \"libvirt\"|unix_sock_group = \"$VIRTGROUP\"|" \
+ $PKG/etc/libvirt/libvirtd.conf.new
+sed -i -e "s|\#unix_sock_rw_perms\ =\ \"0770\"|unix_sock_rw_perms = \"0770\"|" \
+ $PKG/etc/libvirt/libvirtd.conf.new
+
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
diff --git a/libraries/libvirt/libvirt.info b/libraries/libvirt/libvirt.info
index b478f1c7a18e9..91f13e87e468a 100644
--- a/libraries/libvirt/libvirt.info
+++ b/libraries/libvirt/libvirt.info
@@ -1,10 +1,10 @@
PRGNAM="libvirt"
-VERSION="0.9.12"
+VERSION="0.9.13"
HOMEPAGE="http://libvirt.org"
-DOWNLOAD="http://libvirt.org/sources/libvirt-0.9.12.tar.gz"
-MD5SUM="5e842bc55733ceba60c64767580ff3e4"
+DOWNLOAD="http://libvirt.org/sources/libvirt-0.9.13.tar.gz"
+MD5SUM="86cbe53ee662e3b9e8bb0c63c737ba27"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
-REQUIRES=""
+REQUIRES="yajl"
MAINTAINER="Michal Bialozor"
EMAIL="bialyy@o2.pl"
diff --git a/libraries/libvirt/rc.libvirt b/libraries/libvirt/rc.libvirt
new file mode 100644
index 0000000000000..1cdea9a7eaa6f
--- /dev/null
+++ b/libraries/libvirt/rc.libvirt
@@ -0,0 +1,106 @@
+#!/bin/bash
+
+MODULES="tun vhost_net"
+PIDFILE="/var/run/libvirtd.pid"
+TIMEOUT=${TIMEOUT:-40}
+OPTS=${OPTS:-" -v -f /etc/libvirt/libvirtd.conf "}
+
+check_running_machines() {
+
+ i=0
+
+ for j in `/usr/sbin/virsh list | grep running | awk '{print $2;}'` ; do
+ /usr/sbin/virsh shutdown $j
+ done
+
+ echo -n "Waiting machines"
+
+ while [ $(/usr/sbin/virsh list | grep running | wc -l) -gt "0" ]; do
+ if [ "$i" -ge "$TIMEOUT" ];then
+ break
+ fi
+ echo -n "."
+ i=`expr $i + 1`
+ sleep 1
+ done
+
+ echo ""
+
+ if [ $(/usr/sbin/virsh list | grep running | 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 "
+ done
+
+ echo ""
+ sleep 2
+ fi
+
+}
+
+check_processor() {
+
+ egrep 'vmx' /proc/cpuinfo > /dev/null
+
+ if [ "$?" -eq "0" ];then
+ MODULES="$MODULES kvm_intel kvm"
+ fi
+
+ check=$?
+
+ egrep 'svm' /proc/cpuinfo > /dev/null
+
+ if [ "$?" -eq "0" ];then
+ MODULES="$MODULES kvm_amd kvm"
+ fi
+
+ check=`expr $check + $?`
+
+ if [ $check -eq "2" ];then
+ echo "Your systems does not support KVM!"
+ fi
+
+}
+
+start() {
+ if [ -f $PIDFILE ];then
+ echo "libvirt is already running..."
+ exit 1
+ fi
+ echo "Starting libvirtd..."
+ check_processor
+ modprobe -a $MODULES
+ libvirtd -d -l $OPTS
+}
+
+stop() {
+ if [ ! -f $PIDFILE ];then
+ echo "libvirt is not running..."
+ exit 2
+ fi
+ check_running_machines
+ check_processor
+ echo "Stopping libvirtd..."
+ kill -TERM `cat $PIDFILE`
+ modprobe -ra $MODULES
+}
+
+case $1 in
+start)
+ start
+ ;;
+stop)
+ stop
+ ;;
+restart)
+ stop
+ sleep 1
+ start
+ ;;
+*)
+ echo "Usage: $0 (start|stop|restart)"
+ ;;
+esac
+