summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2012-09-04 18:49:29 +0200
committerRobby Workman <rworkman@slackbuilds.org>2012-09-05 20:10:53 -0500
commitc7fd316e7dee3d65ecd1435d4bc440ccd8f82040 (patch)
tree7005745e4287dde2ab2cfb18626fb2adf4ae701b
parent5673fd51af72062da4b80c7c20ee291e5a361682 (diff)
downloadslackbuilds-c7fd316e7dee3d65ecd1435d4bc440ccd8f82040.tar.gz
libraries/libvirt: Updated for version 0.10.1.
Also modified rc.libvirt; some refactoring and cleanups. Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
-rw-r--r--libraries/libvirt/README5
-rw-r--r--libraries/libvirt/doinst.sh28
-rw-r--r--libraries/libvirt/libvirt.SlackBuild95
-rw-r--r--libraries/libvirt/libvirt.info6
-rw-r--r--libraries/libvirt/rc.libvirt28
5 files changed, 56 insertions, 106 deletions
diff --git a/libraries/libvirt/README b/libraries/libvirt/README
index fe57c5e7bd..5707e1254e 100644
--- a/libraries/libvirt/README
+++ b/libraries/libvirt/README
@@ -4,7 +4,7 @@ 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
+by passing some variables to the script
(VAR=yes|no ./libvirt.SlackBuild):
VIRTGROUP=somegroup (default: users) qemu group used
XEN=yes|no (default: no) Xen support
@@ -20,3 +20,6 @@ to /etc/rc.d/rc.local
if [ -x /etc/rc.d/rc.libvirt ]; then
/etc/rc.d/rc.libvirt start
fi
+
+Have a look at the commented part of rc.libvirt for some
+gotchas.
diff --git a/libraries/libvirt/doinst.sh b/libraries/libvirt/doinst.sh
index 5597173070..9ca1b21e7e 100644
--- a/libraries/libvirt/doinst.sh
+++ b/libraries/libvirt/doinst.sh
@@ -12,32 +12,4 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
-config etc/libvirt/qemu.conf.new
-config etc/libvirt/qemu/networks/default.xml.new
-config etc/libvirt/libvirt.conf.new
-config etc/libvirt/libvirtd.conf.new
-config etc/libvirt/nwfilter/qemu-announce-self.xml.new
-config etc/libvirt/nwfilter/no-arp-spoofing.xml.new
-config etc/libvirt/nwfilter/no-mac-spoofing.xml.new
-config etc/libvirt/nwfilter/allow-incoming-ipv4.xml.new
-config etc/libvirt/nwfilter/allow-dhcp-server.xml.new
-config etc/libvirt/nwfilter/allow-arp.xml.new
-config etc/libvirt/nwfilter/no-arp-ip-spoofing.xml.new
-config etc/libvirt/nwfilter/no-arp-mac-spoofing.xml.new
-config etc/libvirt/nwfilter/no-other-rarp-traffic.xml.new
-config etc/libvirt/nwfilter/clean-traffic.xml.new
-config etc/libvirt/nwfilter/qemu-announce-self-rarp.xml.new
-config etc/libvirt/nwfilter/no-mac-broadcast.xml.new
-config etc/libvirt/nwfilter/no-ip-spoofing.xml.new
-config etc/libvirt/nwfilter/allow-dhcp.xml.new
-config etc/libvirt/nwfilter/no-other-l2-traffic.xml.new
-config etc/libvirt/nwfilter/allow-ipv4.xml.new
-config etc/libvirt/nwfilter/no-ip-multicast.xml.new
-config etc/libvirt/lxc.conf.new
-config etc/logrotate.d/libvirtd.new
-config etc/logrotate.d/libvirtd.lxc.new
-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 965edb9f95..b6a9b4450f 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.13
+VERSION=${VERSION:-0.10.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -74,7 +74,7 @@ set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
-rm -rf $PRGNAM-$VERSION
+rm -rf $PRGNAM-$VERSION $PRGNAM-doinst-additions
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
@@ -112,76 +112,34 @@ make \
EXAMPLE_DIR=/usr/doc/$PRGNAM-$VERSION/examples \
install-strip DESTDIR=$PKG
-mv $PKG/etc/libvirt/qemu.conf \
- $PKG/etc/libvirt/qemu.conf.new
-mv $PKG/etc/libvirt/qemu/networks/default.xml \
- $PKG/etc/libvirt/qemu/networks/default.xml.new
-mv $PKG/etc/libvirt/libvirt.conf \
- $PKG/etc/libvirt/libvirt.conf.new
-mv $PKG/etc/libvirt/libvirtd.conf \
- $PKG/etc/libvirt/libvirtd.conf.new
-mv $PKG/etc/libvirt/nwfilter/qemu-announce-self.xml \
- $PKG/etc/libvirt/nwfilter/qemu-announce-self.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-arp-spoofing.xml \
- $PKG/etc/libvirt/nwfilter/no-arp-spoofing.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-mac-spoofing.xml \
- $PKG/etc/libvirt/nwfilter/no-mac-spoofing.xml.new
-mv $PKG/etc/libvirt/nwfilter/allow-incoming-ipv4.xml \
- $PKG/etc/libvirt/nwfilter/allow-incoming-ipv4.xml.new
-mv $PKG/etc/libvirt/nwfilter/allow-dhcp-server.xml \
- $PKG/etc/libvirt/nwfilter/allow-dhcp-server.xml.new
-mv $PKG/etc/libvirt/nwfilter/allow-arp.xml \
- $PKG/etc/libvirt/nwfilter/allow-arp.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-arp-ip-spoofing.xml \
- $PKG/etc/libvirt/nwfilter/no-arp-ip-spoofing.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-arp-mac-spoofing.xml \
- $PKG/etc/libvirt/nwfilter/no-arp-mac-spoofing.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-other-rarp-traffic.xml \
- $PKG/etc/libvirt/nwfilter/no-other-rarp-traffic.xml.new
-mv $PKG/etc/libvirt/nwfilter/clean-traffic.xml \
- $PKG/etc/libvirt/nwfilter/clean-traffic.xml.new
-mv $PKG/etc/libvirt/nwfilter/qemu-announce-self-rarp.xml \
- $PKG/etc/libvirt/nwfilter/qemu-announce-self-rarp.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-mac-broadcast.xml \
- $PKG/etc/libvirt/nwfilter/no-mac-broadcast.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-ip-spoofing.xml \
- $PKG/etc/libvirt/nwfilter/no-ip-spoofing.xml.new
-mv $PKG/etc/libvirt/nwfilter/allow-dhcp.xml \
- $PKG/etc/libvirt/nwfilter/allow-dhcp.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-other-l2-traffic.xml \
- $PKG/etc/libvirt/nwfilter/no-other-l2-traffic.xml.new
-mv $PKG/etc/libvirt/nwfilter/allow-ipv4.xml \
- $PKG/etc/libvirt/nwfilter/allow-ipv4.xml.new
-mv $PKG/etc/libvirt/nwfilter/no-ip-multicast.xml \
- $PKG/etc/libvirt/nwfilter/no-ip-multicast.xml.new
-mv $PKG/etc/libvirt/lxc.conf \
- $PKG/etc/libvirt/lxc.conf.new
-mv $PKG/etc/logrotate.d/libvirtd \
- $PKG/etc/logrotate.d/libvirtd.new
-mv $PKG/etc/logrotate.d/libvirtd.lxc \
- $PKG/etc/logrotate.d/libvirtd.lxc.new
-mv $PKG/etc/logrotate.d/libvirtd.qemu \
- $PKG/etc/logrotate.d/libvirtd.qemu.new
-mv $PKG/etc/logrotate.d/libvirtd.uml \
- $PKG/etc/logrotate.d/libvirtd.uml.new
-mv $PKG/etc/sasl2/libvirt.conf \
- $PKG/etc/sasl2/libvirt.conf.new
-mv $PKG/etc/sysctl.d/libvirtd \
- $PKG/etc/sysctl.d/libvirtd.new
-
-# add an rc.libvirt to start the daemon
+# don't clobber existing configuration files
+for i in etc/libvirt{,/nwfilter,/qemu/networks} etc/{logrotate.d,sasl2,sysctl.d}; do
+ for j in $(ls -1 $PKG/$i); do
+ if [ ! -d $PKG/$i/$j ]; then
+ mv $PKG/$i/$j{,.new}
+ echo "config $i/$j.new" >> $TMP/$PRGNAM-doinst-additions
+ fi
+ done
+done
+
+# add an rc.libvirt to start/stop/restart 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\"|" \
+# we use $VIRTGROUP as our virtualization group, fix auth permissions and
+# consider the fact that by default we got no certs
+sed -i \
+ -e "s|^\#unix_sock_group\ =\ \"libvirt\"|unix_sock_group = \"$VIRTGROUP\"|" \
+ -e "s|^\#unix_sock_rw_perms\ =\ \"0770\"|unix_sock_rw_perms = \"0770\"|" \
+ -e "s|^\#auth_unix_ro.*|auth_unix_ro = \"none\"|" \
+ -e "s|^\#auth_unix_rw.*|auth_unix_rw = \"none\"|" \
+ -e "s|^\#listen_tls|listen_tls = 0|" \
$PKG/etc/libvirt/libvirtd.conf.new
+# still, we use $VIRTGROUP as our virtualization group
+sed -i \
+ -e "s|^\#group\ =\ \"root\"|group = \"$VIRTGROUP\"|" \
+ $PKG/etc/libvirt/qemu.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
@@ -195,6 +153,7 @@ rm -rf $PKG/usr/share/doc
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
+cat $TMP/$PRGNAM-doinst-additions >> $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/libraries/libvirt/libvirt.info b/libraries/libvirt/libvirt.info
index 91f13e87e4..525803892b 100644
--- a/libraries/libvirt/libvirt.info
+++ b/libraries/libvirt/libvirt.info
@@ -1,8 +1,8 @@
PRGNAM="libvirt"
-VERSION="0.9.13"
+VERSION="0.10.1"
HOMEPAGE="http://libvirt.org"
-DOWNLOAD="http://libvirt.org/sources/libvirt-0.9.13.tar.gz"
-MD5SUM="86cbe53ee662e3b9e8bb0c63c737ba27"
+DOWNLOAD="http://libvirt.org/sources/libvirt-0.10.1.tar.gz"
+MD5SUM="5f628e53437b0b0e78477904ba3310af"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="yajl"
diff --git a/libraries/libvirt/rc.libvirt b/libraries/libvirt/rc.libvirt
index 1cdea9a7ea..8cda2bb939 100644
--- a/libraries/libvirt/rc.libvirt
+++ b/libraries/libvirt/rc.libvirt
@@ -1,9 +1,21 @@
-#!/bin/bash
+#!/usr/bin/bash
+# Init script for libvirtd on Slackware
+# Written by Matteo Bernardini <ponce@slackbuilds.org>
+#
+# Note that a dnsmasq daemon is started by libvirtd itself to serve
+# its virtual network, and possibly can conflict with a dnsmasq
+# already running on the system, see
+# http://wiki.libvirt.org/page/Libvirtd_and_dnsmasq
+# Note also that the tun, vhost_net and kvm related modules are
+# automatically loaded at start and removed at stop: edit the
+# script if this behaviour conflicts with anything else running
+# on your setup
MODULES="tun vhost_net"
-PIDFILE="/var/run/libvirtd.pid"
+PIDFILE="/var/run/libvirt/libvirtd.pid"
+NETNAME="$(ls -1 /var/lib/libvirt/network | cut -d. -f1)"
TIMEOUT=${TIMEOUT:-40}
-OPTS=${OPTS:-" -v -f /etc/libvirt/libvirtd.conf "}
+OPTS=${OPTS:-" -v -f /etc/libvirt/libvirtd.conf -p $PIDFILE "}
check_running_machines() {
@@ -71,8 +83,8 @@ start() {
fi
echo "Starting libvirtd..."
check_processor
- modprobe -a $MODULES
- libvirtd -d -l $OPTS
+ /sbin/modprobe -a $MODULES
+ /usr/sbin/libvirtd -d -l $OPTS
}
stop() {
@@ -83,8 +95,12 @@ stop() {
check_running_machines
check_processor
echo "Stopping libvirtd..."
+ for i in "$NETNAME"; do
+ /usr/sbin/virsh net-destroy "$i"
+ done
kill -TERM `cat $PIDFILE`
- modprobe -ra $MODULES
+ sleep 3
+ /sbin/modprobe -ra $MODULES
}
case $1 in