system/qemu-guest-agent: Added (QEMU Guest Agent daemon).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Andrzej Telszewski 2016-08-27 07:44:44 +07:00 committed by David Spencer
parent b3dcfa5a90
commit 2e58882641
6 changed files with 221 additions and 0 deletions

View file

@ -0,0 +1,18 @@
QEMU Guest Agent (qemu-ga) is a daemon intended to be run within virtual
machines. It allows the hypervisor host to perform various operations in
the guest, such as:
- get information from the guest,
- set the guest's system time,
- read/write a file,
- sync and freeze the filesystems,
- suspend the guest,
- reconfigure guest local processors,
- set user's password.
Note that qemu-ga (QEMU Guest Agent) is also part of the standard QEMU
installation. This package is intended for guests only, so that you don't have
to install the complete qemu package there. In general, do not install both
qemu-guest-agent and qemu packages at the same time on the same machine.
Use rc.qemu-ga to launch the daemon at boot and to stop it at shutdown.
You will need to perform host side setup too, to take the advantage of qemu-ga.

View file

@ -0,0 +1,22 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
rm $NEW
fi
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/rc.d/rc.qemu-ga.new

View file

@ -0,0 +1,107 @@
#!/bin/sh
# Slackware build script for qemu-guest-agent
# Copyright 2016 Andrzej Telszewski, Banie
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=qemu-guest-agent
SRCNAM=qemu
VERSION=${VERSION:-2.6.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.bz2
cd $SRCNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Remove double CFLAGS (based on qemu.SlackBuild).
sed -i "s|^\ \ CFLAGS=\"-O2\ | CFLAGS=\"|" configure
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--target-list="" \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-jemalloc \
--disable-debug-info
make qemu-ga
strip --strip-unneeded qemu-ga
mkdir -p $PKG/usr/bin
cp -a qemu-ga $PKG/usr/bin
mkdir -p $PKG/etc/rc.d
cat $CWD/rc.qemu-ga > $PKG/etc/rc.d/rc.qemu-ga.new
make qemu-ga.8
gzip -9 qemu-ga.8
mkdir -p $PKG/usr/man/man8
cp -a qemu-ga.8.gz $PKG/usr/man/man8
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="qemu-guest-agent"
VERSION="2.6.0"
HOMEPAGE="http://wiki.qemu-project.org/Features/QAPI/GuestAgent"
DOWNLOAD="http://wiki.qemu-project.org/download/qemu-2.6.0.tar.bz2"
MD5SUM="ca3f70b43f093e33e9e014f144067f13"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Andrzej Telszewski"
EMAIL="atelszewski@gmail.com"

View file

@ -0,0 +1,45 @@
#!/bin/sh
################################################################################
qemu_ga_start() {
################################################################################
if [ -n "$(pidof qemu-ga)" ]; then
echo "qemu-ga seems to be already running."
return
fi
/usr/bin/qemu-ga -d
}
################################################################################
qemu_ga_stop() {
################################################################################
if [ -z "$(pidof qemu-ga)" ]; then
echo -e "qemu-ga does not seem to be running."
return
fi
kill $(pidof qemu-ga)
}
################################################################################
qemu_ga_restart() {
################################################################################
qemu_ga_stop
sleep 1
qemu_ga_start
}
case "$1" in
'start')
qemu_ga_start
;;
'stop')
qemu_ga_stop
;;
'restart')
qemu_ga_restart
;;
*)
echo "usage: $0 start|stop|restart"
esac

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
qemu-guest-agent: qemu-guest-agent (QEMU Guest Agent daemon)
qemu-guest-agent:
qemu-guest-agent: QEMU Guest Agent (qemu-ga) is a daemon intended to be run within
qemu-guest-agent: virtual machines. It allows the hypervisor host to perform various
qemu-guest-agent: operations in the guest.
qemu-guest-agent:
qemu-guest-agent: Homepage: http://wiki.qemu-project.org/Features/QAPI/GuestAgent
qemu-guest-agent:
qemu-guest-agent:
qemu-guest-agent:
qemu-guest-agent: