summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/x11vnc/OpenSLX
diff options
context:
space:
mode:
Diffstat (limited to 'src/os-plugins/plugins/x11vnc/OpenSLX')
-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
7 files changed, 577 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;