diff options
Diffstat (limited to 'system/spice-vdagent/files/rc.spice-vdagent')
-rw-r--r-- | system/spice-vdagent/files/rc.spice-vdagent | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/system/spice-vdagent/files/rc.spice-vdagent b/system/spice-vdagent/files/rc.spice-vdagent new file mode 100644 index 0000000000..9c3ff19cc8 --- /dev/null +++ b/system/spice-vdagent/files/rc.spice-vdagent @@ -0,0 +1,64 @@ +#!/bin/sh +# +# spice-vdagentd Agent daemon for Spice guests +# +# Red Hat specific script slightly adapted for the Slackware init system +# by Matteo Bernardini <ponce@slackbuilds.org> +# +# 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 $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 $? |