2010-05-12 23:30:46 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for libvirt
|
|
|
|
# Written by Michal Bialozor <bialyy@o2.pl>
|
|
|
|
|
|
|
|
PRGNAM=libvirt
|
2012-09-04 18:49:29 +02:00
|
|
|
VERSION=${VERSION:-0.10.1}
|
2010-05-12 23:30:46 +02:00
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2010-06-04 07:08:59 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-12 23:30:46 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-05-13 00:32:09 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 23:30:46 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 00:32:09 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 23:30:46 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-13 00:32:09 +02:00
|
|
|
LIBDIRSUFFIX="64"
|
2010-06-04 07:08:59 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 23:30:46 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-30 13:21:07 +02:00
|
|
|
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
|
|
|
|
|
2010-05-12 23:30:46 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
2010-05-13 00:32:09 +02:00
|
|
|
cd $TMP
|
2012-09-04 18:49:29 +02:00
|
|
|
rm -rf $PRGNAM-$VERSION $PRGNAM-doinst-additions
|
2010-05-13 00:32:09 +02:00
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
|
|
|
cd $PRGNAM-$VERSION
|
2010-05-12 23:30:46 +02:00
|
|
|
chown -R root:root .
|
|
|
|
chmod -R u+w,go+r-w,a-s .
|
|
|
|
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
2010-05-13 00:32:09 +02:00
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
2010-05-12 23:30:46 +02:00
|
|
|
--bindir=/usr/sbin \
|
|
|
|
--sbindir=/usr/sbin \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--mandir=/usr/man \
|
|
|
|
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
|
|
|
--enable-static=no \
|
|
|
|
--enable-shared=yes \
|
2012-07-30 13:21:07 +02:00
|
|
|
--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 \
|
2010-05-13 00:32:09 +02:00
|
|
|
--build=$ARCH-slackware-linux
|
2010-05-12 23:30:46 +02:00
|
|
|
|
|
|
|
make \
|
|
|
|
HTML_DIR=/usr/doc/$PRGNAM-$VERSION \
|
2010-05-13 00:32:09 +02:00
|
|
|
EXAMPLE_DIR=/usr/doc/$PRGNAM-$VERSION/examples
|
2010-05-12 23:30:46 +02:00
|
|
|
make \
|
|
|
|
HTML_DIR=/usr/doc/$PRGNAM-$VERSION \
|
|
|
|
EXAMPLE_DIR=/usr/doc/$PRGNAM-$VERSION/examples \
|
2010-05-13 00:32:09 +02:00
|
|
|
install-strip DESTDIR=$PKG
|
2010-05-12 23:30:46 +02:00
|
|
|
|
2012-09-04 18:49:29 +02:00
|
|
|
# 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
|
2012-07-30 13:21:07 +02:00
|
|
|
install -D -m 0755 $CWD/rc.libvirt $PKG/etc/rc.d/rc.libvirt.new
|
|
|
|
|
2012-09-04 18:49:29 +02:00
|
|
|
# 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|" \
|
2012-07-30 13:21:07 +02:00
|
|
|
$PKG/etc/libvirt/libvirtd.conf.new
|
|
|
|
|
2012-09-04 18:49:29 +02:00
|
|
|
# still, we use $VIRTGROUP as our virtualization group
|
|
|
|
sed -i \
|
|
|
|
-e "s|^\#group\ =\ \"root\"|group = \"$VIRTGROUP\"|" \
|
|
|
|
$PKG/etc/libvirt/qemu.conf.new
|
|
|
|
|
2010-07-12 19:02:41 +02:00
|
|
|
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
|
2010-05-13 00:32:09 +02:00
|
|
|
|
2010-05-12 23:30:46 +02:00
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a \
|
|
|
|
ABOUT-NLS AUTHORS ChangeLog COPYING* INSTALL README NEWS TODO \
|
2011-10-07 14:15:26 +02:00
|
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
2010-05-12 23:30:46 +02:00
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
2011-10-07 14:15:26 +02:00
|
|
|
rm -rf $PKG/usr/share/doc
|
2010-05-12 23:30:46 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
2012-09-04 18:49:29 +02:00
|
|
|
cat $TMP/$PRGNAM-doinst-additions >> $PKG/install/doinst.sh
|
2010-05-12 23:30:46 +02:00
|
|
|
|
|
|
|
cd $PKG
|
2010-05-13 00:32:09 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|