#!/bin/sh # # spice-vdagentd Agent daemon for Spice guests # # Red Hat specific script slightly adapted for the Slackware init system # by Matteo Bernardini # # Description: Together with a per X-session agent process the spice agent # daemon enhances the spice guest user experience with client # mouse mode, guest <-> client copy and paste support and more. exec="/usr/sbin/spice-vdagentd" prog="spice-vdagentd" port="/dev/virtio-ports/com.redhat.spice.0" pid="/var/run/spice-vdagentd/spice-vdagentd.pid" lockfile=/var/lock/subsys/$prog start() { /sbin/modprobe uinput > /dev/null 2>&1 # In case the previous running vdagentd crashed /usr/bin/rm -f /var/run/spice-vdagentd/spice-vdagent-sock /usr/bin/echo "Starting $prog: " $exec -s $port retval=$? /usr/bin/echo [ $retval -eq 0 ] && echo "$(pidof $prog)" > $pid && /usr/bin/touch $lockfile return $retval } stop() { if [ "$(pidof $prog)" ]; then /usr/bin/echo "Stopping $prog: " /bin/kill $(cat $pid) else /usr/bin/echo "$prog not running" return 1 fi retval=$? /usr/bin/echo [ $retval -eq 0 ] && rm -f $lockfile $pid return $retval } restart() { stop start } case "$1" in start) $1 ;; stop) $1 ;; restart) $1 ;; *) /usr/bin/echo $"Usage: $0 {start|stop|restart}" exit 2 esac exit $?