diff options
author | Sebastian Schmelzer | 2008-10-14 23:07:15 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2008-10-14 23:07:15 +0200 |
commit | 1d927e87ad5183c56e3b24e403c1a1c6e53795d7 (patch) | |
tree | 982fdffcf64e4eab02a11383844d8df645a36fe3 /os-plugins/plugins | |
parent | removed bug where kdmrc.sysconfig is not replaced (diff) | |
download | core-1d927e87ad5183c56e3b24e403c1a1c6e53795d7.tar.gz core-1d927e87ad5183c56e3b24e403c1a1c6e53795d7.tar.xz core-1d927e87ad5183c56e3b24e403c1a1c6e53795d7.zip |
* added distro specific runlevel scripts
* fixed bug #281
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2300 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins')
-rw-r--r-- | os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm | 91 | ||||
-rw-r--r-- | os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm | 88 | ||||
-rw-r--r-- | os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm | 30 | ||||
-rw-r--r-- | os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm | 30 | ||||
-rw-r--r-- | os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm | 91 | ||||
-rw-r--r-- | os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm | 23 | ||||
-rw-r--r-- | os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm | 7 | ||||
-rwxr-xr-x | os-plugins/plugins/x11vnc/files/x11vnc-init (renamed from os-plugins/plugins/x11vnc/files/x11vnc) | 16 |
8 files changed, 366 insertions, 10 deletions
diff --git a/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm b/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm new file mode 100644 index 00000000..fb69f97a --- /dev/null +++ b/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.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/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 OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ +sub new +{ + my $class = shift; + my $self = {}; + return bless $self, $class; + +} + +sub initialize +{ + my $self = shift; + my $engine = shift; + + 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/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm new file mode 100644 index 00000000..6623d22f --- /dev/null +++ b/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/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm b/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm new file mode 100644 index 00000000..a1678912 --- /dev/null +++ b/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/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm b/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm new file mode 100644 index 00000000..1bacf1d8 --- /dev/null +++ b/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/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm new file mode 100644 index 00000000..f43a3893 --- /dev/null +++ b/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/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm new file mode 100644 index 00000000..3379f14d --- /dev/null +++ b/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/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm b/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm index 37dc14bd..de800c42 100644 --- a/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm +++ b/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm @@ -184,9 +184,14 @@ sub installationPhase # 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", "/etc/init.d"); + copyFile("$pluginFilesPath/x11vnc-init", "$pluginRepositoryPath"); + + spitFile("/etc/init.d/x11vnc", $script); + chmod 0755, "/etc/init.d/x11vnc"; + vlog(3, "install init file"); if ( !-x "/usr/bin/x11vnc" ) { diff --git a/os-plugins/plugins/x11vnc/files/x11vnc b/os-plugins/plugins/x11vnc/files/x11vnc-init index 81be80de..a074d8dc 100755 --- a/os-plugins/plugins/x11vnc/files/x11vnc +++ b/os-plugins/plugins/x11vnc/files/x11vnc-init @@ -12,7 +12,7 @@ fi find_xauth () { FOUND=0 RETRIES=4 - [ -z "$1" ] && RETRIES="$1" + [ -z "$1" ] || RETRIES="$1" [ -e "/var/lib/kdm/" ] && XAUTHFILE_KDM=`find /var/lib/kdm/ -iname "A\:0-*"` @@ -30,11 +30,11 @@ find_xauth () { let "RETRIES-=1" find_xauth "$RETRIES" else - echo " .. FAILED (can't find way to authenticate myself against X)" + echo "start FAILED (can't find way to authenticate myself against X)" >>/var/log/x11vnc.debug exit -1 fi else - echo "found ($XAUTHORITY)" + echo "found authfile ($XAUTHORITY)" >>/var/log/x11vnc.debug fi } @@ -42,11 +42,10 @@ START_COMMAND="x11vnc" case "$1" in start) - echo -n " * Loading x11vnc " if [ ! -f /etc/x11vnc/passwd ]; then - echo " .. FAILED (/etc/x11vnc/passwd not found)" - echo " Create it manualy and retry starting x11vnc" + 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 @@ -60,17 +59,16 @@ case "$1" in OUTPUT=`$START_COMMAND` echo "$START_COMMAND" >>/var/log/x11vnc.debug echo "$OUTPUT" >>/var/log/x11vnc.debug - echo " .. OK" ;; stop) pid=`pidof x11vnc` if [ -z "$pid" ] then - echo " * x11vnc not running.." + echo "x11vnc not running" >>/var/log/x11vnc.debug exit -1; else kill -9 $pid - echo " * x11vnc stopped" + echo "x11vnc stopped" >>/var/log/x11vnc.debug fi ;; |