summaryrefslogtreecommitdiff
path: root/system/spice-vdagent/files/rc.spice-vdagent
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2012-11-20 11:37:38 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2016-01-17 09:40:16 +0700
commit6ff9ab871cbe8a8090be0b9d0ed06bcf6fc13a43 (patch)
treeaa02312c8b57c9a9ac9fa64ed6dfc0ab4ab6bc98 /system/spice-vdagent/files/rc.spice-vdagent
parent80182e069db1625d41f42d5211592949a31d1fc6 (diff)
downloadslackbuilds-6ff9ab871cbe8a8090be0b9d0ed06bcf6fc13a43.tar.gz
system/spice-vdagent: Added (spice agent for Linux vms).
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'system/spice-vdagent/files/rc.spice-vdagent')
-rw-r--r--system/spice-vdagent/files/rc.spice-vdagent64
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 $?