app-emulation/qemu-guest-agent: Import from Gentoo

Upstream commit 18974c258b2fe62ef81dd0287c34d86ac712c11a
This commit is contained in:
jenkins 2022-10-18 16:57:25 +00:00 committed by Jeremi Piotrowski
parent c601736c27
commit 75cbb7be90
8 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST qemu-6.0.0.tar.xz 107333232 BLAKE2B 7746329d3e13782b7c346ce4052cc517cfc65cd9b2d514d199e4d5b8570ca79566ec04b0c114db2e97c84e68eb551e0d4cdce1b14b91a88fe08d2a5f682c1418 SHA512 ee3ff00aebec4d8891d2ff6dabe4e667e510b2a4fe3f6190aa34673a91ea32dcd2db2e9bf94c2f1bf05aa79788f17cfbbedc6027c0988ea08a92587b79ee05e4

View File

@ -0,0 +1,11 @@
[Unit]
Description=QEMU Guest Agent
BindTo=dev-virtio\x2dports-org.qemu.guest_agent.0.device
After=dev-virtio\x2dports-org.qemu.guest_agent.0.device
[Service]
ExecStart=-/usr/bin/qemu-ga
Restart=always
RestartSec=0
[Install]

View File

@ -0,0 +1,2 @@
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \
TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"

View File

@ -0,0 +1,11 @@
# Specifies the transport method used to communicate to QEMU on the host side
# Default: virtio-serial
#GA_METHOD="virtio-serial"
# Specifies the device path for the communications back to QEMU on the host
# Default: /dev/virtio-ports/org.qemu.guest_agent.0
#GA_PATH="/dev/virtio-ports/org.qemu.guest_agent.0"
# Additional options to qemu-guest-agent such as --fsfreeze-hook
# See qemu-ga --help for more info
#GA_OPTIONS="-F/etc/qemu/fsfreeze-hook"

View File

@ -0,0 +1,24 @@
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
start() {
GA_METHOD=${GA_METHOD:-virtio-serial}
GA_PATH=${GA_PATH:-/dev/virtio-ports/org.qemu.guest_agent.0}
ebegin "Starting QEMU Guest Agent"
start-stop-daemon --start --pidfile /run/qemu-ga.pid \
--exec /usr/bin/qemu-ga -- -m ${GA_METHOD} -p ${GA_PATH} \
-l /var/log/qemu-ga.log -d -f /run/qemu-ga.pid -t /run ${GA_OPTIONS}
eend $?
}
stop() {
ebegin "Stopping QEMU Guest Agent"
start-stop-daemon --stop --pidfile /run/qemu-ga.pid
eend $?
}

View File

@ -0,0 +1,9 @@
/var/log/qemu-ga.log {
weekly
missingok
rotate 4
compress
delaycompress
copytruncate
minsize 100k
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>ajak@gentoo.org</email>
<name>John Helmert III</name>
</maintainer>
<maintainer type="person">
<email>sam@gentoo.org</email>
<name>Sam James</name>
</maintainer>
<maintainer type="person">
<email>tamiko@gentoo.org</email>
<name>Matthias Maier</name>
</maintainer>
<maintainer type="person">
<email>zlogene@gentoo.org</email>
<name>Mikle Kolyada</name>
</maintainer>
<maintainer type="project">
<email>virtualization@gentoo.org</email>
<name>Gentoo Virtualization Project</name>
</maintainer>
</pkgmetadata>

View File

@ -0,0 +1,79 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
PYTHON_COMPAT=( python3_{7..10} )
inherit systemd toolchain-funcs udev python-any-r1
MY_PN="qemu"
MY_P="${MY_PN}-${PV}"
SRC_URI="http://wiki.qemu.org/download/${MY_P}.tar.xz"
KEYWORDS="amd64 ~ppc ~ppc64 x86"
DESCRIPTION="QEMU Guest Agent (qemu-ga) for use when running inside a VM"
HOMEPAGE="https://wiki.qemu.org/Features/GuestAgent"
LICENSE="GPL-2 BSD-2"
SLOT="0"
IUSE=""
RDEPEND="dev-libs/glib"
DEPEND="${RDEPEND}
${PYTHON_DEPS}"
S="${WORKDIR}/${MY_P}"
src_configure() {
tc-export AR LD OBJCOPY RANLIB
local myconf=(
--prefix=/usr
--sysconfdir=/etc
--libdir="/usr/$(get_libdir)"
--localstatedir=/
--disable-bsd-user
--disable-linux-user
--disable-system
--disable-strip
--enable-tools
--disable-werror
--enable-guest-agent
--python="${PYTHON}"
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
--host-cc="$(tc-getBUILD_CC)"
)
echo "./configure ${myconf[*]}"
./configure "${myconf[@]}" || die
}
src_install() {
dobin build/qga/qemu-ga
# Normal init stuff
newinitd "${FILESDIR}/qemu-ga.init-r1" qemu-guest-agent
newconfd "${FILESDIR}/qemu-ga.conf-r1" qemu-guest-agent
insinto /etc/logrotate.d
newins "${FILESDIR}/qemu-ga.logrotate" qemu-guest-agent
# systemd stuff
udev_newrules "${FILESDIR}/qemu-ga-systemd.udev" 99-qemu-guest-agent.rules
systemd_newunit "${FILESDIR}/qemu-ga-systemd.service" \
qemu-guest-agent.service
}
pkg_postinst() {
elog "You should add 'qemu-guest-agent' to the default runlevel."
elog "e.g. rc-update add qemu-guest-agent default"
udev_reload
}
pkg_postrm() {
udev_reload
}