app-emulation/qemu-guest-agent: Modernize init script

Long due improvement. Instead of defining our own start() and
stop() function, let's just define corresponding variables and
let openrc do its job.

Signed-off-by: Michal Privoznik <michal.privoznik@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43567
Closes: https://github.com/gentoo/gentoo/pull/43567
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Michal Privoznik 2024-11-04 11:59:04 +01:00 committed by Sam James
parent 1d5cfbbf84
commit 574a28c2be
No known key found for this signature in database
GPG Key ID: 738409F520DF9190
4 changed files with 13 additions and 26 deletions

View File

@ -1,24 +0,0 @@
#!/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,11 @@
#!/sbin/openrc-run
# Copyright 1999-2024 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
GA_METHOD=${GA_METHOD:-virtio-serial}
GA_PATH=${GA_PATH:-/dev/virtio-ports/org.qemu.guest_agent.0}
description="QEMU Guest Agent (qemu-ga) for use when running inside a VM"
command="/usr/bin/qemu-ga"
pidfile="/run/qemu-ga.pid"
command_args="-m ${GA_METHOD} -p ${GA_PATH} -l /var/log/qemu-ga.log -d -f ${pidfile} -t /run ${GA_OPTIONS}"

View File

@ -84,7 +84,7 @@ src_install() {
dobin build/qga/qemu-ga
# Normal init stuff
newinitd "${FILESDIR}/qemu-ga.init-r1" qemu-guest-agent
newinitd "${FILESDIR}/qemu-ga.init-r2" qemu-guest-agent
newconfd "${FILESDIR}/qemu-ga.conf-r1" qemu-guest-agent
insinto /etc/logrotate.d

View File

@ -84,7 +84,7 @@ src_install() {
dobin build/qga/qemu-ga
# Normal init stuff
newinitd "${FILESDIR}/qemu-ga.init-r1" qemu-guest-agent
newinitd "${FILESDIR}/qemu-ga.init-r2" qemu-guest-agent
newconfd "${FILESDIR}/qemu-ga.conf-r1" qemu-guest-agent
insinto /etc/logrotate.d