blob: 98c29ccec63dd2c03f0d68e537e068c6091cd461 (
plain) (
blame)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# Copyright (c) 2007..2008 - RZ Uni Freiburg
# Copyright (c) 2008 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org
#
# script is included from init via the "." load function - thus it has all
# variables and functions available
# check if the plugin config directory is generally available or if the client
# configuration failed somehow
[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
# function to add vnc functionality to xorg server
addvnc2xorg () {
sed -e '/^# autog/a# modified by x11vnc plugin (adding vnc module config)' \
-e '/\"Module\"/a\\ \\ Load "vnc"' \
-e '/\"Device\"/a\\ \\ Option "rfbauth"\t "/etc/X11"' \
-e '/\"Device\"/a\\ \\ Option "usevnc"\t "yes"}' \
-i /mnt/etc/X11/xorg.conf
}
# main script
if [ -e /initramfs/plugin-conf/x11vnc.conf ]; then
. /initramfs/plugin-conf/x11vnc.conf
if [ $x11vnc_active -ne 0 ]; then
[ $DEBUGLEVEL -gt 0 ] && echo "executing the 'x11vnc' os-plugin ...";
# configure x11vnc user mode or framebuffer
if [ "$x11vnc_mode" = "x11user" || "$x11vnc_mode" = "fb" ] ; then
# create config dir for stage 3
mkdir -p /mnt/etc/x11vnc
# default parameters
PARAMS="-bg -forever"
# client restrictions
if [ -z x11vnc_allowed_hosts ]; then
PARAMS="$PARAMS -allow $x11vnc_allowd_hosts"
fi
# mode
case "$x11vnc_mode" in
x11user)
PARAMS="$PARAMS -display :0"
X11VNC_X11=1
;;
fb)
PARAMS="$PARAMS -rawfb console"
;;
esac
# auth type
case "$x11vnc_auth_type" in
passwd)
# use x11vnc passwd style - recommended
echo "$x11vnc_pass" > /mnt/etc/x11vnc/passwd
echo "__BEGIN_VIEWONLY__" >> /mnt/etc/x11vnc/passwd
echo "$x11vnc_viewonlypass" >> /mnt/etc/x11vnc/passwd
# multiuser handling
sed -i "s/,/\n/" /mnt/etc/x11vnc/passwd
# add parameter to commandline
PARAMS="$PARAMS -passwdfile rm:/etc/x11vnc/passwd"
;;
rfbauth)
# use rfbauth
vncpasswd "$x11vnc_pass" > /mnt/etc/x11vnc/passwd
PARAMS="$PARAMS -rfbauth /etc/x11vnc/passwd"
;;
*)
# no password
PARAMS="$PARAMS -nopw"
;;
esac
# force viewonly
if [ "$x11vnc_force_viewonly" = "1" \
-o "$x11vnc_force_viewonly" = "yes" ]; then
PARAMS="$PARAMS -viewonly"
fi
# force localhost
if [ "$x11vnc_force_localhost" = "1" \
-o "$x11vnc_force_localhost" = "yes" ]; then
PARAMS="$PARAMS -localhost"
fi
# enable logging
if [ "$x11vnc_logging" = "1" -o "$x11vnc_logging" = "yes" ]; then
PARAMS="$PARAMS -o /var/log/x11vnc.log"
fi
# shared desktops
if [ "$x11vnc_shared" = "1" -o "$x11vnc_shared" = "yes" ]; then
PARAMS="$PARAMS -shared"
fi
# scale desktop
if [ "$x11vnc_scale" != "" ]; then
$PARAMS="$PARAMS -scale $x11vnc_scale"
fi
# write config file
echo "# parameters generated by $0" > /mnt/etc/x11vnc/x11vnc.conf
echo "X11VNC_PARAMS=\"$PARAMS\"" >> /mnt/etc/x11vnc/x11vnc.conf
echo "X11VNC_X11=\"$X11VNC_X11\"" >> /mnt/etc/x11vnc/x11vnc.conf
rllinker "x11vnc" 30 10
[ $DEBUGLEVEL -gt 0 ] && echo "done with 'x11vnc' os-plugin ...";
# x11gen allows a general access to the running X server at every time
elif [ "$x11vnc_mode" = "x11gen" ]
( waitfor /mnt/etc/X11/xorg.conf 10000; addvnc2xorg ) &
fi
fi
|