aports/testing/spice-vdagent/spice-vdagentd.initd

98 lines
2.6 KiB
Plaintext

#!/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
}