commit:     574a28c2be4e60eab04f62f45bcd714445a11cf6
Author:     Michal Privoznik <michal.privoznik <AT> gmail <DOT> com>
AuthorDate: Mon Nov  4 10:59:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 26 15:25:32 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=574a28c2

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 <AT> 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 <AT> gentoo.org>

 .../qemu-guest-agent/files/qemu-ga.init-r1         | 24 ----------------------
 .../qemu-guest-agent/files/qemu-ga.init-r2         | 11 ++++++++++
 .../qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild |  2 +-
 .../qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild |  2 +-
 4 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/app-emulation/qemu-guest-agent/files/qemu-ga.init-r1 
b/app-emulation/qemu-guest-agent/files/qemu-ga.init-r1
deleted file mode 100644
index f08c082709b3..000000000000
--- a/app-emulation/qemu-guest-agent/files/qemu-ga.init-r1
+++ /dev/null
@@ -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 $?
-}

diff --git a/app-emulation/qemu-guest-agent/files/qemu-ga.init-r2 
b/app-emulation/qemu-guest-agent/files/qemu-ga.init-r2
new file mode 100644
index 000000000000..29cf9859083e
--- /dev/null
+++ b/app-emulation/qemu-guest-agent/files/qemu-ga.init-r2
@@ -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}"

diff --git a/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild 
b/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild
index a4e4b3ee8fe2..8e6f6c77c024 100644
--- a/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild
+++ b/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild
@@ -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

diff --git a/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild 
b/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild
index a4e4b3ee8fe2..8e6f6c77c024 100644
--- a/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild
+++ b/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild
@@ -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

Reply via email to