summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/x11vnc
diff options
context:
space:
mode:
Diffstat (limited to 'src/os-plugins/plugins/x11vnc')
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm94
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm88
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm30
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm30
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm91
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm23
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm221
-rw-r--r--src/os-plugins/plugins/x11vnc/XX_x11vnc.sh135
-rwxr-xr-xsrc/os-plugins/plugins/x11vnc/files/x11vnc-init83
9 files changed, 795 insertions, 0 deletions
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..1e6a97a5
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm
@@ -0,0 +1,94 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program 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 suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the x11vnc plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #! /bin/sh
+ # completely generic start/stop script, generated via stage1 'x11vnc' plugin
+ # install
+ #
+ # This script manages the services needed to run x11vnc software
+
+ # Basic support for the Linux Standard Base Specification 1.3
+ ### BEGIN INIT INFO
+ # Provides: x11vnc
+ # Required-Start:
+ # Required-Stop:
+ # Default-Start:
+ # Default-Stop:
+ # Short-Description: Manages the services needed to run x11vnc software
+ # Description: Manages the services needed to run x11vnc software
+ ### END INIT INFO
+
+ [ -f /opt/openslx/plugin-repo/x11vnc/x11vnc-init ] \\
+ && CMD="/opt/openslx/plugin-repo/x11vnc/x11vnc-init"
+
+ case \$1 in
+ start)
+ echo "Starting x11vnc ..."
+ \$CMD start
+ ;;
+ stop)
+ # message output should match the given vendor-os
+ echo "Stopping x11vnc ..."
+ \$CMD stop
+ ;;
+ #status)
+ # echo "Say something useful here ..."
+ #;;
+ restart)
+ "\$0" stop
+ "\$0" start
+ ;;
+ esac
+ exit 0
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..6623d22f
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,88 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program 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 suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/debian.pm
+# - provides Debian-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # Ubuntu/Debian specific start/stop script, generated via stage1 'x11vnc'
+ # plugin install
+ # inspiration taken from x11vnc start script:
+ # Copyright 1998-2007 x11vnc, Inc. All rights reserved.
+ #
+ # This script manages the services needed to run x11vnc software
+
+ # Basic support for the Linux Standard Base Specification 1.3
+ ### BEGIN INIT INFO
+ # Provides: x11vnc
+ # Required-Start: \$syslog
+ # Required-Stop:
+ # Default-Start: 2 3 5
+ # Default-Stop: 0 6
+ # Short-Description: Manages the services needed to run x11vnc software
+ # Description: Manages the services needed to run x11vnc software
+ ### END INIT INFO
+
+ # initialize the lsb status messages
+ . /lib/lsb/init-functions
+
+ [ -f /opt/openslx/plugin-repo/x11vnc/x11vnc-init ] \\
+ && CMD="/opt/openslx/plugin-repo/x11vnc/x11vnc-init"
+
+ case \$1 in
+ start)
+ log_daemon_msg "Starting x11vnc background services ..." "x11vnc"
+ \$CMD start
+ log_end_msg \$?
+ ;;
+ stop)
+ log_daemon_msg "Stopping x11vnc background services ..." "x11vnc"
+ \$CMD stop
+ log_end_msg \$?
+ ;;
+ #status)
+ # log_daemon_msg "Say something useful here ..."
+ #;;
+ restart)
+ \$0 stop
+ \$0 start
+ exit $?
+ ;;
+ *)
+ log_success_msg "Usage: \$0 {start|stop|restart}"
+ exit 2
+ ;;
+ esac
+ exit 0
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..a1678912
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program 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 suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+# TODO: implement!
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..1bacf1d8
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program 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 suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+# TODO: implement!
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..f43a3893
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,91 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program 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 suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the x11vnc plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # SuSE compatible start/stop script, generated via stage1 'x11vnc' plugin
+ # installation
+ #
+ # inspiration taken from x11vnc start script:
+ # Copyright 1998-2007 x11vnc, Inc. All rights reserved.
+ #
+ # This script manages the services needed to run x11vnc software
+
+ # Basic support for the Linux Standard Base Specification 1.3
+ ### BEGIN INIT INFO
+ # Provides: x11vnc
+ # Required-Start: \$syslog
+ # Required-Stop:
+ # Default-Start: 2 3 5
+ # Default-Stop: 0 6
+ # Short-Description: Manages the services needed to run x11vnc software
+ # Description: Manages the services needed to run x11vnc software
+ ### END INIT INFO
+
+ # load the helper stuff
+ . /etc/rc.status
+ # reset the script status
+ rc_reset
+
+ [ -f /opt/openslx/plugin-repo/x11vnc/x11vnc-init ] \\
+ && CMD="/opt/openslx/plugin-repo/x11vnc/x11vnc-init"
+
+ case \$1 in
+ start)
+ echo -n "Starting x11vnc background services ..."
+ \$CMD start
+ rc_status -v
+ ;;
+ stop)
+ # message output should match the given vendor-os
+ echo -n "Stopping x11vnc background services ..."
+ rc_reset
+ \$CMD stop
+ rc_status -v
+ ;;
+ #status)
+ # echo -n "Say something useful here ..."
+ #;;
+ restart)
+ "\$0" stop
+ "\$0" start
+ ;;
+ *)
+ echo "Usage: `basename "\$0"` {start|stop|restart}"
+ exit 1
+ ;;
+ esac
+ exit 0
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..3379f14d
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,23 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program 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 suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+# inherit everything from Debian (as Ubuntu is based on it anyway)
+use base qw(x11vnc::OpenSLX::Distro::Debian);
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm
new file mode 100644
index 00000000..fe06648c
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm
@@ -0,0 +1,221 @@
+# Copyright (c) 2007, 2008 - OpenSLX GmbH
+#
+# This program 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 suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc.pm
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::x11vnc;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+ my $self = {
+ name => 'x11vnc',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ enables x11vnc server (user or xorg)
+ End-of-Here
+ # waits for xorg to add configuration if needed
+ precedence => 70,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'x11vnc::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'x11vnc' plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+
+ 'x11vnc::mode' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ set x11vnc to listen on Xorg user sessions (default), general
+ access to the Xorg server (including displaymanager login) and
+ console framebuffer.
+ End-of-Here
+ content_regex => qr{^(x11user|x11mod|fb)$},
+ content_descr => 'x11user for user, x11mod for access via Xorg module or fb',
+ default => 'x11user',
+ },
+
+ 'x11vnc::scale' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ scale screen size (e.g. as fraction 2/3 or as decimal 0.5)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+
+ 'x11vnc::shared' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ by default x11vnc is always called with the -shared option
+ End-of-Here
+ content_regex => qr{^(yes|no|1|0)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'yes',
+ },
+
+ 'x11vnc::force_viewonly' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ disable user interaction with vnc
+ End-of-Here
+ content_regex => qr{^(yes|no|1|0)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'no',
+ },
+
+ 'x11vnc::auth_type' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ set authentication type of the vnc connection. rfbauth is
+ available for x11user and fb only.
+ End-of-Here
+ content_regex => qr{^(passwd|rfbauth|none)$},
+ content_descr => 'choose: passwd, rfbauth, none',
+ default => 'passwd',
+ },
+
+ 'x11vnc::allowed_hosts' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ set allowed hosts (multiple hosts are seperated by semicolons,
+ (simple) subnets are possible too e.g. "192.168.")
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+
+ 'x11vnc::force_localhost' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ force x11vnc to only accept local connections and only listen
+ on the loopback device
+ End-of-Here
+ content_regex => qr{^(1|0|yes|no)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'no',
+ },
+
+ 'x11vnc::pass' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ viewonly password (you can add multiple passwords seperated
+ by semicolons, if you're using rfbauth only the first one is
+ used)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+
+ 'x11vnc::viewonlypass' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ viewonly password (you can add multiple passwords seperated by
+ semicolons, disabled with rfb-auth)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'viewonly',
+ },
+
+ 'x11vnc::logging' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ enable logging
+ End-of-Here
+ content_regex => qr{^(1|0|yes|no)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'yes',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepositoryPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
+ # should we distinguish between the two different packages!?
+ # libvnc should be part of the xorg package!? (so no check needed)
+ my $engine = $self->{'os-plugin-engine'};
+ if (!isInPath('x11vnc')) {
+ $engine->installPackages(
+ $engine->getInstallablePackagesForSelection('x11vnc')
+ );
+ } else {
+ vlog(3, "x11vnc is already installed");
+ }
+
+ # get path of files we need to install
+ my $pluginFilesPath = "$openslxBasePath/lib/plugins/$self->{'name'}/files";
+ my $script = $self->{distro}->fillRunlevelScript();
+
+ # copy all needed files now
+ copyFile("$pluginFilesPath/x11vnc-init", "$pluginRepositoryPath");
+
+ spitFile("/etc/init.d/x11vnc", $script);
+ chmod 0755, "/etc/init.d/x11vnc";
+
+ vlog(3, "install init file");
+
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/XX_x11vnc.sh b/src/os-plugins/plugins/x11vnc/XX_x11vnc.sh
new file mode 100644
index 00000000..3970e468
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/XX_x11vnc.sh
@@ -0,0 +1,135 @@
+# Copyright (c) 2007..2009 - RZ Uni Freiburg
+# Copyright (c) 2009 - 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 '/n \"Device\"/a\\ \ Option "usevnc" "yes"' \
+ -e '/n \"Device\"/a\\ \ Option "rfbauth" "/etc/X11/vncpasswd"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "VNC Keyboard" "ExtraKeyboard"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "VNC Mouse" "ExtraPointer"' \
+ -e '/\"CorePointer\"/ {
+a\
+EndSection\
+Section "InputDevice"\
+ Identifier "VNC Keyboard"\
+ Driver "rfbkeyb"\
+EndSection\
+Section "InputDevice"\
+ Identifier "VNC Mouse"\
+ Driver "rfbmouse"
+}' -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" -o "$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 ...";
+
+ # x11mod offers access to the running X server via module
+ elif [ "$x11vnc_mode" = "x11mod" ]; then
+ # password setting (use stage4 environment)
+ echo -e "$x11vnc_pass\n$x11vnc_viewonlypass" | chroot /mnt vncpasswd -f \
+ > /mnt/etc/X11/vncpasswd
+ ( waitfor /mnt/etc/X11/xorg.conf 10000; addvnc2xorg ) &
+ fi
+ fi
+else
+ [ $DEBUGLEVEL -gt 2 ] && \
+ echo "No configuration file found for x11vnc plugin."
+fi
diff --git a/src/os-plugins/plugins/x11vnc/files/x11vnc-init b/src/os-plugins/plugins/x11vnc/files/x11vnc-init
new file mode 100755
index 00000000..548b2114
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/files/x11vnc-init
@@ -0,0 +1,83 @@
+#!/bin/bash
+# --------------------------------
+# /etc/init.d/x11vnc
+# --------------------------------
+
+if [ -f /etc/x11vnc/x11vnc.conf ]
+then
+ . /etc/x11vnc/x11vnc.conf
+fi
+
+# find xauthority file
+find_xauth () {
+ FOUND=0
+ RETRIES=4
+ [ -z "$1" ] || RETRIES="$1"
+
+ [ -e "/var/lib/kdm/" ] &&
+ XAUTHFILE_KDM=`find /var/lib/kdm/ -iname "A\:0-*"`
+ [ -e "/var/run/xauth/" ] &&
+ XAUTHFILE_KDM2=`find /var/run/xauth/ -iname "A\:0-*"`
+ [ -e "/var/lib/xdm/authdir/authfiles/" ] &&
+ XAUTHFILE_XDM=`find /var/lib/xdm/authdir/authfiles/ -iname "A\:0-*"`
+ [ -e "/var/lib/gdm/" ] &&
+ XAUTHFILE_GDM=`find /var/lib/gdm/ -iname *Xauth*`
+
+ [ -f "$XAUTHFILE_KDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM"
+ [ -f "$XAUTHFILE_KDM2" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM2"
+ [ -f "$XAUTHFILE_XDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_XDM"
+ [ -f "$XAUTHFILE_GDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_GDM"
+
+ if [ "$FOUND" -eq "0" ]; then
+ if [ "$RETRIES" -gt "0" ]; then
+ let "RETRIES-=1"
+ find_xauth "$RETRIES"
+ else
+ echo "start FAILED (can't find way to authenticate myself against X)" >>/var/log/x11vnc.debug
+ exit -1
+ fi
+ else
+ echo "found authfile ($XAUTHORITY)" >>/var/log/x11vnc.debug
+ fi
+}
+
+START_COMMAND="x11vnc"
+
+case "$1" in
+ start)
+
+ if [ ! -f /etc/x11vnc/passwd ]; then
+ echo " start FAILED (/etc/x11vnc/passwd not found)" >>/var/log/x11vnc.debug
+ echo " Create it manualy and retry starting x11vnc" >>/var/log/x11vnc.debug
+ exit -1;
+ fi
+
+ #su -c "$COMMAND" -l x11vnc &
+ if [ $X11VNC_X11 = 1 ]; then
+ find_xauth
+ START_COMMAND="$START_COMMAND -auth $XAUTHORITY $X11VNC_PARAMS"
+ else
+ START_COMMAND="$START_COMMAND $X11VNC_PARAMS"
+ fi
+ OUTPUT=`$START_COMMAND`
+ echo "$START_COMMAND" >>/var/log/x11vnc.debug
+ echo "$OUTPUT" >>/var/log/x11vnc.debug
+ ;;
+ stop)
+ pid=`pidof x11vnc`
+ if [ -z "$pid" ]
+ then
+ echo "x11vnc not running" >>/var/log/x11vnc.debug
+ exit -1;
+ else
+ kill -9 $pid
+ echo "x11vnc stopped" >>/var/log/x11vnc.debug
+ fi
+
+ ;;
+ *)
+ echo "x11vnc startscript"
+ echo "Usage: $0 (start|stop)"
+ ;;
+esac
+exit 0