From: Marcin Krol Date: Fri, 13 Mar 2020 20:35:49 +0000 (+0100) Subject: - missing files X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=1808542e6fa13980600d8c824a60da2182ba9c7b;p=packages%2Fqemu.git - missing files --- diff --git a/99-qemu-guest-agent.rules b/99-qemu-guest-agent.rules new file mode 100644 index 0000000..8a290ab --- /dev/null +++ b/99-qemu-guest-agent.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \ + TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service" diff --git a/qemu-guest-agent.init b/qemu-guest-agent.init new file mode 100755 index 0000000..2ca1ec5 --- /dev/null +++ b/qemu-guest-agent.init @@ -0,0 +1,124 @@ +#!/bin/sh +# +# qemu-ga qemu-ga QEMU Guest Agent +# +# chkconfig: 345 12 88 +# +# description: qemu-ga QEMU Guest Agent + +# Source function library +. /etc/rc.d/init.d/functions + +# Get service config - may override defaults +[ -f /etc/sysconfig/qemu-ga ] && . /etc/sysconfig/qemu-ga + +pidfile="/var/run/qemu-ga.pid" + +# configtest itself +# must return non-zero if check failed +# output is discarded if checkconfig is ran without details +configtest() { + /usr/bin/qemu-ga -D + return $? +} + +# wrapper for configtest +checkconfig() { + local details=${1:-0} + + if [ $details = 1 ]; then + # run config test and display report (status action) + show "Checking %s configuration" "qemu-ga"; busy + local out + out=$(configtest 2>&1) + RETVAL=$? + if [ $RETVAL = 0 ]; then + ok + else + fail + fi + [ "$out" ] && echo >&2 "$out" + else + # run config test and abort with nice message if failed + # (for actions checking status before action). + configtest >/dev/null 2>&1 + RETVAL=$? + if [ $RETVAL != 0 ]; then + show "Checking %s configuration" "qemu-ga"; fail + nls 'Configuration test failed. See details with %s "checkconfig"' $0 + exit $RETVAL + fi + fi +} + +start() { + # Check if the service is already running? + if [ -f /var/lock/subsys/qemu-ga ]; then + msg_already_running "qemu-ga" + return + fi + + checkconfig + msg_starting "qemu-ga" + daemon /usr/bin/qemu-ga -d -l /var/log/qemu-ga + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/qemu-ga +} + +stop() { + if [ ! -f /var/lock/subsys/qemu-ga ]; then + msg_not_running "qemu-ga" + return + fi + + # Stop daemons. + msg_stopping "qemu-ga" + killproc --pidfile $pidfile qemu-ga -TERM + rm -f /var/lock/subsys/qemu-ga +} + +condrestart() { + if [ ! -f /var/lock/subsys/qemu-ga ]; then + msg_not_running "qemu-ga" + RETVAL=$1 + return + fi + + checkconfig + stop + start +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + checkconfig + stop + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 + ;; + checkconfig|configtest) + checkconfig 1 + ;; + status) + status --pidfile $pidfile qemu-ga + RETVAL=$? + ;; + *) + msg_usage "$0 {start|stop|restart|try-restart|force-reload|checkconfig|status}" + exit 3 +esac + +exit $RETVAL diff --git a/qemu-guest-agent.logrotate b/qemu-guest-agent.logrotate new file mode 100644 index 0000000..0c64059 --- /dev/null +++ b/qemu-guest-agent.logrotate @@ -0,0 +1,6 @@ +/var/log/qemu-ga +{ + postrotate + /sbin/service qemu-ga restart >/dev/null + endscript +}