aboutsummaryrefslogtreecommitdiffstats
path: root/testing/spice-vdagent/spice-vdagentd.initd
blob: 5c04d0242ca09d5090d754dc15bf00db01fec9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/sbin/openrc-run

# This file is part of spice-vdagent
# by Stuart Cardall <developer@it-offshore.co.uk>

sockfile="/var/run/spice-vdagentd/spice-vdagent-sock"
pidfile="/var/run/spice-vdagentd/spice-vdagentd.pid"
command="/usr/sbin/spice-vdagentd"
command_args="-X"
msgfile=/tmp/spice-vdagent.msg
extra_commands="info"

MODULES="uinput"

depend() {
	need net
	need logger
}

start_pre() {
	# make sure dir for pidfile exists. /var/run is tmpfs...
	checkpath --directory ${pidfile%/*}
	# load userspace input driver for copy & paste support
	ebegin "Loading uinput kernel module for ${SVCNAME}"
        for mod in $MODULES; do
		modprobe -q $mod
	done
	eend $?
	rm -f $sockfile
}

start() {
	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --start $command --pidfile $pidfile -- $command_args
	eend $?
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --quiet --pidfile $pidfile
	eend $? "Failed to stop ${SVCNAME}"
	ebegin "Unloading uinput kernel module for ${SVCNAME}"
        for mod in $MODULES; do
		rmmod $mod
	done
        eend $?
	rm -f $sockfile
}

info() {
	cat > $msgfile <<EOF
By default the daemon is run with $command_args="-X" to disable consolekit
support & allow a single agent session only. Run without '-X' & install lxdm
or slim for muliple sessions.

------------------------------------------------------------------------------
Settings for libvirt:
------------------------------------------------------------------------------
<channel type='spicevmc'>
  <target type='virtio' name='com.redhat.spice.0'/>
  <address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
  <input type='tablet' bus='usb'/>
  <input type='mouse' bus='ps2'/>
  <input type='keyboard' bus='ps2'/>
<graphics type='spice' autoport='yes' listen='127.0.0.1'>
  <listen type='address' address='127.0.0.1'/>
  <channel name='main' mode='insecure'/>
  <channel name='record' mode='insecure'/>
  <image compression='auto_glz'/>
  <jpeg compression='auto'/>
  <zlib compression='auto'/>
  <playback compression='on'/>
  <streaming mode='filter'/>
  <mouse mode='client'/>
  <clipboard copypaste='yes'/>
  <filetransfer enable='yes'/>
</graphics>
<video>
  <model type='qxl' ram='65536' vram='9216' heads='1'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>

------------------------------------------------------------------------------
Settings for /etc/X11/xorg.conf:   <install xf86-video-qxl>
------------------------------------------------------------------------------
Section "Device"
	Identifier  "Videocard0"
	Driver      "qxl"
	Option	    "EnableSurfaces" "0"
EndSection
EOF

cat $msgfile
rm -f $msgfile
}