summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu
diff options
context:
space:
mode:
authorClément Péron <peron.clem@gmail.com>2023-03-10 19:54:22 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-14 17:10:00 +0000
commit1c01cbaed575a6bfc97b32af1b55c3707fdaf473 (patch)
tree73fd64a8a38069525d545144959f5b0e52c6673f /meta/recipes-devtools/qemu/qemu
parent7c2b42695d95e5916a13bbdeb26cb396e91a5b89 (diff)
downloadpoky-1c01cbaed575a6bfc97b32af1b55c3707fdaf473.tar.gz
qemu: split out qemu-guest-agent, add startup scripts
Split out the QEMU guest agent into a separate package. The agent is intended to be installed within a QEMU VM guest where a user is likely to not want to have the rest of the QEMU installation within it. Additionally, an initscript, udev rules file, and systemd unit file are added to the package so that the guest agent can start automatically; the former two come from Debian's packaging for qemu-guest-agent. (From OE-Core rev: d62fd31c70a9161596594f43c58c73898bfcf52c) Signed-off-by: Brenda Streiff <brenda.streiff@ni.com> Signed-off-by: Clément Péron <peron.clem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu')
-rw-r--r--meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init75
-rw-r--r--meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev2
2 files changed, 77 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
new file mode 100644
index 0000000000..5ebaaddeae
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.init
@@ -0,0 +1,75 @@
1# SPDX-License-Identifier: GPL-2.0-only
2# Initially written by: Michael Tokarev <mjt@tls.msk.ru>
3# For QEMU Debian downstream package
4
5set -e
6
7. /etc/init.d/functions
8
9PATH=/sbin:/usr/sbin:/bin:/usr/bin
10DESC="QEMU Guest Agent"
11NAME=qemu-ga
12DAEMON=@bindir@/$NAME
13PIDFILE=/var/run/$NAME.pid
14
15# config
16DAEMON_ARGS=""
17# default transport
18TRANSPORT=virtio-serial:/dev/virtio-ports/org.qemu.guest_agent.0
19NO_START=0
20
21test ! -r /etc/default/qemu-guest-agent || . /etc/default/qemu-guest-agent
22test "$NO_START" = "0" || exit 0
23test -x "$DAEMON" || exit 0
24
25#
26# Function that checks whenever system has necessary environment
27# It also splits $TRANSPORT into $method and $path
28#
29do_check_transport() {
30 method=${TRANSPORT%%:*};
31 path=${TRANSPORT#*:}
32 case "$method" in
33 virtio-serial | isa-serial)
34 if [ ! -e "$path" ]; then
35 echo "$NAME: transport endpoint not found, not starting"
36 return 1
37 fi
38 ;;
39 esac
40}
41
42case "$1" in
43 start)
44 do_check_transport || exit 0
45 echo -n "Starting $DESC: "
46 start-stop-daemon -S -p $PIDFILE -x "$DAEMON" -- \
47 $DAEMON_ARGS -d -m "$method" -p "$path"
48 echo "$NAME."
49 ;;
50 stop)
51 echo -n "Stopping $DESC: "
52 start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
53 echo "$NAME."
54 ;;
55 status)
56 status "$DAEMON"
57 exit $?
58 ;;
59 restart|force-reload)
60 do_check_transport || exit 0
61 echo -n "Restarting $DESC: "
62 start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
63 sleep 1
64 start-stop-daemon -S -p $PIDFILE -x "$DAEMON" -- \
65 $DAEMON_ARGS -d -m "$method" -p "$path"
66 echo "$NAME."
67 ;;
68 *)
69 N=/etc/init.d/$NAME
70 echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
71 exit 1
72 ;;
73esac
74
75exit 0
diff --git a/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev
new file mode 100644
index 0000000000..47097057e3
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/qemu-guest-agent.udev
@@ -0,0 +1,2 @@
1SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \
2 TAG+="systemd", ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"