diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
commit | 415856bdd4f48ab4f2732996f0bae58595092bbe (patch) | |
tree | ede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/libvirt |
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/libvirt')
-rw-r--r-- | community/libvirt/PKGBUILD | 71 | ||||
-rw-r--r-- | community/libvirt/libvirt.install | 38 | ||||
-rw-r--r-- | community/libvirt/libvirtd.conf.d | 3 | ||||
-rwxr-xr-x | community/libvirt/libvirtd.rc.d | 65 | ||||
-rw-r--r-- | community/libvirt/openbsd-netcat-default.patch | 24 | ||||
-rw-r--r-- | community/libvirt/unixperms.patch | 47 |
6 files changed, 248 insertions, 0 deletions
diff --git a/community/libvirt/PKGBUILD b/community/libvirt/PKGBUILD new file mode 100644 index 000000000..8cda3a98e --- /dev/null +++ b/community/libvirt/PKGBUILD @@ -0,0 +1,71 @@ +# $Id: PKGBUILD 44221 2011-04-04 14:55:37Z spupykin $ +# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com> +# Contributor: Jonathan Wiersma <archaur at jonw dot org> + +pkgname=libvirt +pkgver=0.9.0 +pkgrel=1 +pkgdesc="API for controlling virtualization engines (openvz,kvm,qemu,virtualbox,xen,etc)" +arch=('i686' 'x86_64') +url="http://libvirt.org/" +license=('LGPL') +depends=('e2fsprogs' 'gnutls' 'iptables' 'libxml2' 'parted' 'polkit' 'python2' + 'avahi' 'yajl' 'libpciaccess' 'udev' 'dbus-core' 'libxau' 'libxdmcp' 'libpcap' + 'curl' 'libsasl' 'libgcrypt' 'libgpg-error' 'openssl' 'libxcb' 'gcc-libs' + 'iproute2') +makedepends=('pkgconfig' 'lvm2') +optdepends=('bridge-utils: for briged networking (default)' + 'dnsmasq: for NAT/DHCP for guests' + 'kernel26-ovz24: for openvz guests' + 'kvm' + 'lxc' + 'openbsd-netcat: for remote management over ssh' + 'qemu' + 'user-mode-linux' + 'virtualbox_bin' + 'virtualbox-ose' + 'xen') +options=('emptydirs' '!libtool') +backup=('etc/conf.d/libvirtd' + 'etc/libvirt/libvirtd.conf' + 'etc/libvirt/qemu.conf' + 'etc/sasl2/libvirt.conf') +install="libvirt.install" +source=("http://libvirt.org/sources/$pkgname-$pkgver.tar.gz" + libvirtd.rc.d + libvirtd.conf.d + openbsd-netcat-default.patch + unixperms.patch) +md5sums=('53d005e6f3732aba1fd6b2718f9cec99' + '26005f9fe6085e2858f855d94eace5f4' + 'cb4e9bc6b209c1f3077d3698bf1d4437' + '7d5a841d51321be56ad3c4f93d112fb0' + 'db95aecdf2ccf3693fef5821cdcb7eba') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + # python2 fix + export PYTHON=`which python2` + for file in $(find . -name '*.py' -print); do + sed -i 's_#!.*/usr/bin/python_#!/usr/bin/python2_' $file + sed -i 's_#!.*/usr/bin/env.*python_#!/usr/bin/env python2_' $file + done + +# for more information on authentication see http://libvirt.org/auth.html +# If you wish to have unix-permissions based access rather than only polkit +# access, create a group called libvirt and uncomment the line below: +# patch -Np1 -i "$srcdir"/unixperms.patch + + [ $NOEXTRACT -eq 1 ] || patch -Np1 -i "$srcdir"/openbsd-netcat-default.patch + + export LDFLAGS=-lX11 + [ -f Makefile ] || ./configure --prefix=/usr --libexec=/usr/lib/"$pkgname" \ + --with-storage-lvm --without-xen --with-udev --without-hal + find -name Makefile -exec sed -i 's#-L /usr#-L/usr#' {} \; + make -j1 + make DESTDIR="$pkgdir" install + install -D -m755 "$srcdir"/libvirtd.rc.d "$pkgdir"/etc/rc.d/libvirtd + install -D -m644 "$srcdir"/libvirtd.conf.d "$pkgdir"/etc/conf.d/libvirtd + rm -rf $pkgdir/var/run +} diff --git a/community/libvirt/libvirt.install b/community/libvirt/libvirt.install new file mode 100644 index 000000000..3881386d2 --- /dev/null +++ b/community/libvirt/libvirt.install @@ -0,0 +1,38 @@ +_libvirt_setup() { + rm -f /usr/lib/python?.?/site-packages/libvirt.pyc + echo ">>> To use libvirt as a non-root user:" + echo ">>> Use polkit to grant access." + echo ">>> ...or change the access model in /etc/libvirt/libvirtd.conf." + echo ">>> (see unixperms.patch in PKGBUILD for help)" + echo "" +} + +post_install() { + _libvirt_setup || return 1 + echo ">>> Be sure to see optdepends as you may find some of them helpfull." + echo ">>> Especially: bridge-utils, dnsmasq, and hal." + echo "" + echo ">>> To start libvirtd run: '/etc/rc.d/libvirtd start' as root." + echo ">>> Add 'libvirtd' to daemons in /etc/rc.conf if you want it to load upon" + echo ">>> booting." + echo "" + /bin/true +} + +post_upgrade() { + _libvirt_setup || return 1 + echo ">>> To finish the upgrade, restart libvirtd by running the command:" + echo ">>> '/etc/rc.d/libvirtd restart' as root or rebooting." + echo ">>> You may also need to run 'rm -rf ~/.libvirt'" + echo "" + /bin/true +} + +post_remove() { + rm -f /usr/lib/python[0-9].[0-9]/site-packages/libvirt.pyc + echo ">>> You may wish to delete the group 'libvirt' if it still exists." + echo ">>> It can be removed by running 'groupdel libvirt' as root." + echo "" + depmod -a + /bin/true +} diff --git a/community/libvirt/libvirtd.conf.d b/community/libvirt/libvirtd.conf.d new file mode 100644 index 000000000..31d559c83 --- /dev/null +++ b/community/libvirt/libvirtd.conf.d @@ -0,0 +1,3 @@ +LIBVIRTD_CONFIG= +LIBVIRTD_ARGS= +KRB5_KTNAME=/etc/libvirt/krb5.tab diff --git a/community/libvirt/libvirtd.rc.d b/community/libvirt/libvirtd.rc.d new file mode 100755 index 000000000..12e3d927e --- /dev/null +++ b/community/libvirt/libvirtd.rc.d @@ -0,0 +1,65 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/conf.d/libvirtd +. /etc/rc.d/functions + +LIBVIRTD_CONFIG_ARGS= +if [ -n "$LIBVIRTD_CONFIG" ] +then + LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG" +fi + +PID=`pidof -o %PPID /usr/sbin/libvirtd` +case "$1" in + start) + stat_busy "Starting libvirtd" + for i in /var/run/libvirt/qemu /var/run/libvirt/lxc /var/run/libvirt/uml /var/run/libvirt/network; do + [ -d $i ] || mkdir -p $i + done + [ -z "$PID" ] && ( + mkdir -p /var/{cache,run}/libvirt + rm -rf /var/cache/libvirt/* + KRB5_KTNAME=$KRB5_KTNAME \ + /usr/sbin/libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS + ) + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon libvirtd + stat_done + fi + ;; + stop) + stat_busy "Stopping libvirtd" + [ ! -z "$PID" ] && ( + kill $PID &> /dev/null + rm -rf /var/cache/libvirt/* + rm -f /var/run/libvirtd.pid + ) + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon acpid + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + reload) + stat_busy "Reloading libvirtd configuration" + [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + stat_done + fi + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload}" + ;; +esac +exit 0 diff --git a/community/libvirt/openbsd-netcat-default.patch b/community/libvirt/openbsd-netcat-default.patch new file mode 100644 index 000000000..382611c74 --- /dev/null +++ b/community/libvirt/openbsd-netcat-default.patch @@ -0,0 +1,24 @@ +diff -wbBur libvirt-0.9.0/src/qemu/qemu_migration.c libvirt-0.9.0.my/src/qemu/qemu_migration.c +--- libvirt-0.9.0/src/qemu/qemu_migration.c 2011-03-29 14:18:53.000000000 +0000 ++++ libvirt-0.9.0.my/src/qemu/qemu_migration.c 2011-04-04 14:34:43.000000000 +0000 +@@ -819,7 +819,7 @@ + unixfile); + } + else if (qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { +- const char *args[] = { "nc", "-U", unixfile, NULL }; ++ const char *args[] = { "nc.openbsd", "-U", unixfile, NULL }; + internalret = qemuMonitorMigrateToCommand(priv->mon, QEMU_MONITOR_MIGRATE_BACKGROUND, args); + } else { + internalret = -1; +diff -wbBur libvirt-0.9.0/src/remote/remote_driver.c libvirt-0.9.0.my/src/remote/remote_driver.c +--- libvirt-0.9.0/src/remote/remote_driver.c 2011-03-29 12:57:01.000000000 +0000 ++++ libvirt-0.9.0.my/src/remote/remote_driver.c 2011-04-04 14:34:23.000000000 +0000 +@@ -777,7 +777,7 @@ + cmd_argv[j++] = strdup ("none"); + } + cmd_argv[j++] = strdup (priv->hostname); +- cmd_argv[j++] = strdup (netcat ? netcat : "nc"); ++ cmd_argv[j++] = strdup (netcat ? netcat : "nc.openbsd"); + cmd_argv[j++] = strdup ("-U"); + cmd_argv[j++] = strdup (sockname ? sockname : + (flags & VIR_CONNECT_RO diff --git a/community/libvirt/unixperms.patch b/community/libvirt/unixperms.patch new file mode 100644 index 000000000..b3fb86cf5 --- /dev/null +++ b/community/libvirt/unixperms.patch @@ -0,0 +1,47 @@ +diff -ur libvirt-0.7.4-orig/daemon/libvirtd.conf libvirt-0.7.4-patched/daemon/libvirtd.conf +--- libvirt-0.7.4-orig/daemon/libvirtd.conf 2009-11-23 03:10:33.398655655 -0800 ++++ libvirt-0.7.4-patched/daemon/libvirtd.conf 2009-11-23 03:09:37.831189671 -0800 +@@ -78,14 +78,14 @@ + # without becoming root. + # + # This is restricted to 'root' by default. +-#unix_sock_group = "libvirt" ++unix_sock_group = "libvirt" + + # Set the UNIX socket permissions for the R/O socket. This is used + # for monitoring VM status only + # + # Default allows any user. If setting group ownership may want to + # restrict this to: +-#unix_sock_ro_perms = "0777" ++unix_sock_ro_perms = "0770" + + # Set the UNIX socket permissions for the R/W socket. This is used + # for full management of VMs +@@ -95,7 +95,7 @@ + # + # If not using PolicyKit and setting group ownership for access + # control then you may want to relax this to: +-#unix_sock_rw_perms = "0770" ++unix_sock_rw_perms = "0770" + + # Set the name of the directory in which sockets will be found/created. + #unix_sock_dir = "/var/run/libvirt" +@@ -126,7 +126,7 @@ + # + # To restrict monitoring of domains you may wish to enable + # an authentication mechanism here +-#auth_unix_ro = "none" ++auth_unix_ro = "none" + + # Set an authentication scheme for UNIX read-write sockets + # By default socket permissions only allow root. If PolicyKit +@@ -135,7 +135,7 @@ + # + # If the unix_sock_rw_perms are changed you may wish to enable + # an authentication mechanism here +-#auth_unix_rw = "none" ++auth_unix_rw = "none" + + # Change the authentication scheme for TCP sockets. + # |