From 5a8c8a1638eea2ff6897046fcbc94bb42ccbe94d Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 6 Apr 2008 13:40:09 +0000 Subject: * made names of distro module consistent across OpenSLX - now the always start with a capital letter followed by all lowercase (Debian, Fedora, Gentoo, Suse, Ubuntu) * refactored loading of distro modules into a separate function (loadDistroModule() in Basics.pm) * finished support to logging to a file in syslog plugin * worked at desktop plugin (still not working, though) git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1721 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm | 7 +- os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm | 142 ++++++++++++++++++++ os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm | 30 +++++ os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm | 133 +++++++++++++++++++ os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm | 146 ++++++++++++++++++++ os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm | 23 ++++ os-plugins/plugins/vmware/OpenSLX/Distro/debian.pm | 31 ----- os-plugins/plugins/vmware/OpenSLX/Distro/fedora.pm | 48 ------- os-plugins/plugins/vmware/OpenSLX/Distro/gentoo.pm | 132 ------------------ os-plugins/plugins/vmware/OpenSLX/Distro/suse.pm | 147 --------------------- os-plugins/plugins/vmware/OpenSLX/Distro/ubuntu.pm | 141 -------------------- 11 files changed, 477 insertions(+), 503 deletions(-) create mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm create mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm create mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm create mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm create mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm delete mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/debian.pm delete mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/fedora.pm delete mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/gentoo.pm delete mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/suse.pm delete mode 100644 os-plugins/plugins/vmware/OpenSLX/Distro/ubuntu.pm (limited to 'os-plugins/plugins/vmware/OpenSLX') diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm index 317bd13f..3c128f14 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm @@ -8,11 +8,10 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# base.pm -# - provides empty base of the OpenSLX OSPlugin Distro API for the vmware -# plugin. +# vmware/OpenSLX/Distro/Base.pm +# - provides base implementation of the Distro API for the vmware plugin. # ----------------------------------------------------------------------------- -package OpenSLX::Distro::Base; +package vmware::OpenSLX::Distro::Base; use strict; use warnings; diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm new file mode 100644 index 00000000..e8f40c16 --- /dev/null +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm @@ -0,0 +1,142 @@ +# 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/ +# ----------------------------------------------------------------------------- +# vmware/OpenSLX/Distro/debian.pm +# - provides Debian-specific overrides of the Distro API for the vmware +# plugin. +# ----------------------------------------------------------------------------- +package vmware::OpenSLX::Distro::Debian; + +use strict; +use warnings; + +use base qw(vmware::OpenSLX::Distro::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +sub fillRunlevelScript +{ + my $self = shift; + my $location = shift; + + my $script = unshiftHereDoc(<<" End-of-Here"); + #! /bin/sh + # Ubuntu specific start/stop script, generated via stage1 'vmware' plugin + # install + # inspiration taken from vmware start script: + # Copyright 1998-2007 VMware, Inc. All rights reserved. + # + # This script manages the services needed to run VMware software + + # Basic support for the Linux Standard Base Specification 1.3 + ### BEGIN INIT INFO + # Provides: VMware + # Required-Start: \$syslog + # Required-Stop: + # Default-Start: 2 3 5 + # Default-Stop: 0 6 + # Short-Description: Manages the services needed to run VMware software + # Description: Manages the services needed to run VMware software + ### END INIT INFO + load_modules() { + # to be filled in via the stage1 configuration script + modprobe -qa vmmon vmnet vmblock 2>/dev/null || echo "Problem here!" + # most probably nobody wants to run the parallel port driver ... + #modprobe vm... + } + unload_modules() { + # to be filled with the proper list within via the stage1 configuration + # script + rmmod vmmon vmblock vmnet 2>/dev/null + } + # the bridged interface + setup_vmnet0() { + if [ -n "\$vmnet0" ] ; then + # the path might be directly point to the plugin dir + $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0 + fi + } + # we definately prefer the hostonly interface for NATed operation too + # distinction is made via enabled forwarding + setup_vmnet1() { + if [ -n "\$vmnet1" ] ; then + test -c /dev/vmnet1 || mknod c 119 1 /dev/vmnet1 + # the path might be directly point to the plugin dir + $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\ + /dev/vmnet1 vmnet1 + dhcpif="\$dhcpif vmnet1" + ip addr add \$vmnet1 dev vmnet1 + if [ -n "\$vmnet1nat" ] ; then + # needs refinement interface name for eth0 is known in stage3 already + echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null + echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null + #iptables -A -s vmnet1 -d eth0 + fi + fi + } + # incomplete ... + setup_vmnet8() { + if [ -n "\$vmnet8" ] ; then + test -c /dev/vmnet1 || mknod c 119 8 /dev/vmnet8 + # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 + $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ + -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf + dhcpif="\$dhcpif vmnet8" + ip addr add \$vmnet8 dev vmnet8 + fi + } + runvmdhcpd() { + if [ -n "\$dhcpif" ] ; then + # the path might be directly point to the plugin dir + mkdir /var/run/vmware 2>/dev/null + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ + /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif + fi + } + # initialize the lsb status messages + . /lib/lsb/init-functions + + case \$1 in + start) + log_daemon_msg "Starting vmware background services ..." "vmware" + # load the configuration file + . /etc/vmware/slxvmconfig + load_modules || log_warning_msg "The loading of vmware modules failed" + setup_vmnet0 || log_warning_msg "Problems setting up vmnet0 interface" + setup_vmnet1 || log_warning_msg "Problems setting up vmnet1 interface" + setup_vmnet8 || log_warning_msg "Problems setting up vmnet8 interface" + runvmdhcpd + log_end_msg $? + ;; + stop) + # message output should match the given vendor-os + log_daemon_msg "Stopping vmware background services ..." "vmware" + killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ + vmware-tray 2>/dev/null + # wait for shutting down of interfaces + usleep 50000 + unload_modules + log_end_msg $? + ;; + status) + log_daemon_msg "Say something useful here ..." + ;; + esac + exit 0 + End-of-Here + return $script; +} + +1; \ No newline at end of file diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm new file mode 100644 index 00000000..1a68a286 --- /dev/null +++ b/os-plugins/plugins/vmware/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/ +# ----------------------------------------------------------------------------- +# vmware/OpenSLX/Distro/Fedora.pm +# - provides Fedora-specific overrides of the Distro API for the vmware +# plugin. +# ----------------------------------------------------------------------------- +package vmware::OpenSLX::Distro::Fedora; + +use strict; +use warnings; + +use base qw(vmware::OpenSLX::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ + +# TODO: implement! + +1; \ No newline at end of file diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm new file mode 100644 index 00000000..594a55cd --- /dev/null +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm @@ -0,0 +1,133 @@ +# 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/ +# ----------------------------------------------------------------------------- +# vmware/OpenSLX/Distro/Gentoo.pm +# - provides Gentoo-specific overrides of the Distro API for the vmware +# plugin. +# ----------------------------------------------------------------------------- +package vmware::OpenSLX::Distro::Gentoo; + +use strict; +use warnings; + +use base qw(vmware::OpenSLX::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ + +sub fillRunlevelScript +{ + my $self = shift; + my $location = shift; + + my $script = unshiftHereDoc(<<" End-of-Here"); + #!/sbin/runscript + # Gentoo compatible (hopefully) start/stop script, generated via stage1 'vmware' + # plugin installation + # + # inspiration taken from vmware start script: + # Copyright 1998-2007 VMware, Inc. All rights reserved. + # + # This script manages the services needed to run VMware software + + # dependency definitions + depend() { + # use syslog + # need ... + } + + # helper functions + load_modules() { + # to be filled in via the stage1 configuration script + modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 + # most probably nobody wants to run the parallel port driver ... + #modprobe vm... + } + unload_modules() { + # to be filled with the proper list within via the stage1 configuration + # script + rmmod vmmon vmblock vmnet 2>/dev/null + } + # the bridged interface + setup_vmnet0() { + if [ -n "\$vmnet0" ] ; then + # the path might be directly point to the plugin dir + $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0 + fi + } + # we definately prefer the hostonly interface for NATed operation too + # distinction is made via enabled forwarding + setup_vmnet1() { + if [ -n "\$vmnet1" ] ; then + test -c /dev/vmnet1 || mknod c 119 1 /dev/vmnet1 + # the path might be directly point to the plugin dir + $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\ + /dev/vmnet1 vmnet1 + dhcpif="\$dhcpif vmnet1" + ip addr add \$vmnet1 dev vmnet1 + if [ -n "\$vmnet1nat" ] ; then + # needs refinement interface name for eth0 is known in stage3 already + echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null + echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null + #iptables -A -s vmnet1 -d eth0 + fi + fi + } + # incomplete ... + setup_vmnet8() { + if [ -n "\$vmnet8" ] ; then + test -c /dev/vmnet1 || mknod c 119 8 /dev/vmnet8 + # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 + $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ + -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf + dhcpif="\$dhcpif vmnet8" + ip addr add \$vmnet8 dev vmnet8 + fi + } + runvmdhcpd() { + if [ -n "\$dhcpif" ] ; then + # the path might be directly point to the plugin dir + mkdir /var/run/vmware 2>/dev/null + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ + /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif + fi + } + + # start/stop functions + start() { + ebegin "Starting vmware background services ..." + # load the configuration file + . /etc/vmware/slxvmconfig + load_modules || eerror "The loading of vmware modules failed" + setup_vmnet0 || eerror "Problems setting up vmnet0 interface" + setup_vmnet1 || eerror "Problems setting up vmnet1 interface" + setup_vmnet8 || eerror "Problems setting up vmnet8 interface" + runvmdhcpd + eend $? + } + + stop() { + # message output should match the given vendor-os + ebegin "Stopping vmware background services ..." + killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ + vmware-tray 2>/dev/null + # wait for shutting down of interfaces + usleep 50000 + unload_modules + eend $? + } + End-of-Here + return $script; +} + +1; diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm new file mode 100644 index 00000000..9c380cb6 --- /dev/null +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm @@ -0,0 +1,146 @@ +# 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/ +# ----------------------------------------------------------------------------- +# vmware/OpenSLX/Distro/Suse.pm +# - provides SUSE-specific overrides of the Distro API for the vmware plugin. +# ----------------------------------------------------------------------------- +package vmware::OpenSLX::Distro::Suse; + +use strict; +use warnings; + +use base qw(vmware::OpenSLX::Distro::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +sub fillRunlevelScript +{ + my $self = shift; + my $location = shift; + + my $script = unshiftHereDoc(<<" End-of-Here"); + #! /bin/sh + # SuSE compatible start/stop script, generated via stage1 'vmware' plugin + # installation + # + # inspiration taken from vmware start script: + # Copyright 1998-2007 VMware, Inc. All rights reserved. + # + # This script manages the services needed to run VMware software + + # Basic support for the Linux Standard Base Specification 1.3 + ### BEGIN INIT INFO + # Provides: VMware + # Required-Start: \$syslog + # Required-Stop: + # Default-Start: 2 3 5 + # Default-Stop: 0 6 + # Short-Description: Manages the services needed to run VMware software + # Description: Manages the services needed to run VMware software + ### END INIT INFO + + # helper functions + load_modules() { + # to be filled in via the stage1 configuration script + modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 + # most probably nobody wants to run the parallel port driver ... + #modprobe vm... + } + unload_modules() { + # to be filled with the proper list within via the stage1 configuration + # script + rmmod vmmon vmblock vmnet 2>/dev/null + } + # the bridged interface + setup_vmnet0() { + if [ -n "\$vmnet0" ] ; then + # the path might be directly point to the plugin dir + $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0 + fi + } + # we definately prefer the hostonly interface for NATed operation too + # distinction is made via enabled forwarding + setup_vmnet1() { + if [ -n "\$vmnet1" ] ; then + test -c /dev/vmnet1 || mknod c 119 1 /dev/vmnet1 + # the path might be directly point to the plugin dir + $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\ + /dev/vmnet1 vmnet1 + dhcpif="\$dhcpif vmnet1" + ip addr add \$vmnet1 dev vmnet1 + if [ -n "\$vmnet1nat" ] ; then + # needs refinement interface name for eth0 is known in stage3 already + echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null + echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null + #iptables -A -s vmnet1 -d eth0 + fi + fi + } + # incomplete ... + setup_vmnet8() { + if [ -n "\$vmnet8" ] ; then + test -c /dev/vmnet1 || mknod c 119 8 /dev/vmnet8 + # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 + $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ + -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf + dhcpif="\$dhcpif vmnet8" + ip addr add \$vmnet8 dev vmnet8 + fi + } + runvmdhcpd() { + if [ -n "\$dhcpif" ] ; then + # the path might be directly point to the plugin dir + mkdir /var/run/vmware 2>/dev/null + $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ + /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif + fi + } + # load the helper stuff + . /etc/rc.status + # reset the script status + rc_reset + + case \$1 in + start) + echo -n "Starting vmware background services ..." + # load the configuration file + . /etc/vmware/slxvmconfig + load_modules + setup_vmnet0 + setup_vmnet1 + setup_vmnet8 + runvmdhcpd + rc_status -v + ;; + stop) + # message output should match the given vendor-os + echo -n "Stopping vmware background services ..." + killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ + vmware-tray 2>/dev/null + # wait for shutting down of interfaces + usleep 50000 + unload_modules + rc_status -v + ;; + status) + echo -n "Say something useful here ..." + ;; + esac + exit 0 + End-of-Here + return $script; +} + +1; diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm new file mode 100644 index 00000000..02b44b5c --- /dev/null +++ b/os-plugins/plugins/vmware/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/ +# ----------------------------------------------------------------------------- +# vmware/OpenSLX/Distro/Ubuntu.pm +# - provides Ubuntu-specific overrides of the Distro API for the vmware +# plugin. +# ----------------------------------------------------------------------------- +package vmware::OpenSLX::Distro::Ubuntu; + +use strict; +use warnings; + +# inherit everything from Debian (as Ubuntu is based on it anyway) +use base qw(vmware::OpenSLX::Distro::Debian); + +1; \ No newline at end of file diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/debian.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/debian.pm deleted file mode 100644 index 32a3d4bd..00000000 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/debian.pm +++ /dev/null @@ -1,31 +0,0 @@ -# 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/ -# ----------------------------------------------------------------------------- -# debian.pm -# - provides Debian-specific overrides of the OpenSLX Distro API for the -# desktop plugin. -# ----------------------------------------------------------------------------- -package OpenSLX::Distro::debian; - -use strict; -use warnings; - -use base qw(OpenSLX::Distro::Base); - -use OpenSLX::Basics; -use OpenSLX::Utils; - -################################################################################ -### interface methods -################################################################################ - -### Erbe von Ubuntu! - -1; \ No newline at end of file diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/fedora.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/fedora.pm deleted file mode 100644 index 0bc9ebdc..00000000 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/fedora.pm +++ /dev/null @@ -1,48 +0,0 @@ -# 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/ -# ----------------------------------------------------------------------------- -# Fedora.pm -# - provides Fedora-specific overrides of the OpenSLX OSSetup API. -# ----------------------------------------------------------------------------- -package OpenSLX::OSSetup::Distro::Fedora; - -use strict; -use warnings; - -use base qw(OpenSLX::OSSetup::Distro::Base); - -use OpenSLX::Basics; - -################################################################################ -### interface methods -################################################################################ -sub new -{ - my $class = shift; - my $self = {}; - return bless $self, $class; -} - -sub initialize -{ - my $self = shift; - my $engine = shift; - - $self->SUPER::initialize($engine); - $self->{'packager-type'} = 'rpm'; - $self->{'meta-packager-type'} = $ENV{SLX_META_PACKAGER} || 'yum'; - $self->{'stage1c-faked-files'} = [ - '/etc/fstab', - '/etc/mtab', - ]; - return; -} - -1; \ No newline at end of file diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/gentoo.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/gentoo.pm deleted file mode 100644 index 924c2fc2..00000000 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/gentoo.pm +++ /dev/null @@ -1,132 +0,0 @@ -# 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/ -# ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSSetup API. -# ----------------------------------------------------------------------------- -package OpenSLX::OSSetup::Distro::Gentoo; - -use strict; -use warnings; - -use base qw(OpenSLX::OSSetup::Distro::Base); - -use OpenSLX::Basics; - -################################################################################ -### interface methods -################################################################################ - -sub fillRunlevelScript -{ - my $self = shift; - my $location = shift; - - my $script = unshiftHereDoc(<<" End-of-Here"); - #!/sbin/runscript - # Gentoo compatible (hopefully) start/stop script, generated via stage1 'vmware' - # plugin installation - # - # inspiration taken from vmware start script: - # Copyright 1998-2007 VMware, Inc. All rights reserved. - # - # This script manages the services needed to run VMware software - - # dependency definitions - depend() { - # use syslog - # need ... - } - - # helper functions - load_modules() { - # to be filled in via the stage1 configuration script - modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 - # most probably nobody wants to run the parallel port driver ... - #modprobe vm... - } - unload_modules() { - # to be filled with the proper list within via the stage1 configuration - # script - rmmod vmmon vmblock vmnet 2>/dev/null - } - # the bridged interface - setup_vmnet0() { - if [ -n "\$vmnet0" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0 - fi - } - # we definately prefer the hostonly interface for NATed operation too - # distinction is made via enabled forwarding - setup_vmnet1() { - if [ -n "\$vmnet1" ] ; then - test -c /dev/vmnet1 || mknod c 119 1 /dev/vmnet1 - # the path might be directly point to the plugin dir - $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\ - /dev/vmnet1 vmnet1 - dhcpif="\$dhcpif vmnet1" - ip addr add \$vmnet1 dev vmnet1 - if [ -n "\$vmnet1nat" ] ; then - # needs refinement interface name for eth0 is known in stage3 already - echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null - echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null - #iptables -A -s vmnet1 -d eth0 - fi - fi - } - # incomplete ... - setup_vmnet8() { - if [ -n "\$vmnet8" ] ; then - test -c /dev/vmnet1 || mknod c 119 8 /dev/vmnet8 - # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 - $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ - -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf - dhcpif="\$dhcpif vmnet8" - ip addr add \$vmnet8 dev vmnet8 - fi - } - runvmdhcpd() { - if [ -n "\$dhcpif" ] ; then - # the path might be directly point to the plugin dir - mkdir /var/run/vmware 2>/dev/null - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ - /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif - fi - } - - # start/stop functions - start() { - ebegin "Starting vmware background services ..." - # load the configuration file - . /etc/vmware/slxvmconfig - load_modules || eerror "The loading of vmware modules failed" - setup_vmnet0 || eerror "Problems setting up vmnet0 interface" - setup_vmnet1 || eerror "Problems setting up vmnet1 interface" - setup_vmnet8 || eerror "Problems setting up vmnet8 interface" - runvmdhcpd - eend $? - } - - stop() { - # message output should match the given vendor-os - ebegin "Stopping vmware background services ..." - killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ - vmware-tray 2>/dev/null - # wait for shutting down of interfaces - usleep 50000 - unload_modules - eend $? - } - End-of-Here - return $script; -} - -1; diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/suse.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/suse.pm deleted file mode 100644 index b3a39df5..00000000 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/suse.pm +++ /dev/null @@ -1,147 +0,0 @@ -# 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/ -# ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX Distro API for the desktop -# plugin. -# ----------------------------------------------------------------------------- -package OpenSLX::Distro::suse; - -use strict; -use warnings; - -use base qw(OpenSLX::Distro::Base); - -use OpenSLX::Basics; -use OpenSLX::Utils; - -################################################################################ -### interface methods -################################################################################ - -sub fillRunlevelScript -{ - my $self = shift; - my $location = shift; - - my $script = unshiftHereDoc(<<" End-of-Here"); - #! /bin/sh - # SuSE compatible start/stop script, generated via stage1 'vmware' plugin - # installation - # - # inspiration taken from vmware start script: - # Copyright 1998-2007 VMware, Inc. All rights reserved. - # - # This script manages the services needed to run VMware software - - # Basic support for the Linux Standard Base Specification 1.3 - ### BEGIN INIT INFO - # Provides: VMware - # Required-Start: \$syslog - # Required-Stop: - # Default-Start: 2 3 5 - # Default-Stop: 0 6 - # Short-Description: Manages the services needed to run VMware software - # Description: Manages the services needed to run VMware software - ### END INIT INFO - - # helper functions - load_modules() { - # to be filled in via the stage1 configuration script - modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 - # most probably nobody wants to run the parallel port driver ... - #modprobe vm... - } - unload_modules() { - # to be filled with the proper list within via the stage1 configuration - # script - rmmod vmmon vmblock vmnet 2>/dev/null - } - # the bridged interface - setup_vmnet0() { - if [ -n "\$vmnet0" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0 - fi - } - # we definately prefer the hostonly interface for NATed operation too - # distinction is made via enabled forwarding - setup_vmnet1() { - if [ -n "\$vmnet1" ] ; then - test -c /dev/vmnet1 || mknod c 119 1 /dev/vmnet1 - # the path might be directly point to the plugin dir - $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\ - /dev/vmnet1 vmnet1 - dhcpif="\$dhcpif vmnet1" - ip addr add \$vmnet1 dev vmnet1 - if [ -n "\$vmnet1nat" ] ; then - # needs refinement interface name for eth0 is known in stage3 already - echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null - echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null - #iptables -A -s vmnet1 -d eth0 - fi - fi - } - # incomplete ... - setup_vmnet8() { - if [ -n "\$vmnet8" ] ; then - test -c /dev/vmnet1 || mknod c 119 8 /dev/vmnet8 - # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 - $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ - -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf - dhcpif="\$dhcpif vmnet8" - ip addr add \$vmnet8 dev vmnet8 - fi - } - runvmdhcpd() { - if [ -n "\$dhcpif" ] ; then - # the path might be directly point to the plugin dir - mkdir /var/run/vmware 2>/dev/null - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ - /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif - fi - } - # load the helper stuff - . /etc/rc.status - # reset the script status - rc_reset - - case \$1 in - start) - echo -n "Starting vmware background services ..." - # load the configuration file - . /etc/vmware/slxvmconfig - load_modules - setup_vmnet0 - setup_vmnet1 - setup_vmnet8 - runvmdhcpd - rc_status -v - ;; - stop) - # message output should match the given vendor-os - echo -n "Stopping vmware background services ..." - killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ - vmware-tray 2>/dev/null - # wait for shutting down of interfaces - usleep 50000 - unload_modules - rc_status -v - ;; - status) - echo -n "Say something useful here ..." - ;; - esac - exit 0 - End-of-Here - return $script; -} - -1; diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/ubuntu.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/ubuntu.pm deleted file mode 100644 index 7346918c..00000000 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/ubuntu.pm +++ /dev/null @@ -1,141 +0,0 @@ -# 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/ -# ----------------------------------------------------------------------------- -# Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX OSSetup API. -# ----------------------------------------------------------------------------- -package OpenSLX::Distro::ubuntu; - -use strict; -use warnings; - -use base qw(OpenSLX::Distro::Base); - -use OpenSLX::Basics; -use OpenSLX::Utils; - -################################################################################ -### interface methods -################################################################################ - -sub fillRunlevelScript -{ - my $self = shift; - my $location = shift; - - my $script = unshiftHereDoc(<<" End-of-Here"); - #! /bin/sh - # Ubuntu specific start/stop script, generated via stage1 'vmware' plugin - # install - # inspiration taken from vmware start script: - # Copyright 1998-2007 VMware, Inc. All rights reserved. - # - # This script manages the services needed to run VMware software - - # Basic support for the Linux Standard Base Specification 1.3 - ### BEGIN INIT INFO - # Provides: VMware - # Required-Start: \$syslog - # Required-Stop: - # Default-Start: 2 3 5 - # Default-Stop: 0 6 - # Short-Description: Manages the services needed to run VMware software - # Description: Manages the services needed to run VMware software - ### END INIT INFO - load_modules() { - # to be filled in via the stage1 configuration script - modprobe -qa vmmon vmnet vmblock 2>/dev/null || echo "Problem here!" - # most probably nobody wants to run the parallel port driver ... - #modprobe vm... - } - unload_modules() { - # to be filled with the proper list within via the stage1 configuration - # script - rmmod vmmon vmblock vmnet 2>/dev/null - } - # the bridged interface - setup_vmnet0() { - if [ -n "\$vmnet0" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0 - fi - } - # we definately prefer the hostonly interface for NATed operation too - # distinction is made via enabled forwarding - setup_vmnet1() { - if [ -n "\$vmnet1" ] ; then - test -c /dev/vmnet1 || mknod c 119 1 /dev/vmnet1 - # the path might be directly point to the plugin dir - $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\ - /dev/vmnet1 vmnet1 - dhcpif="\$dhcpif vmnet1" - ip addr add \$vmnet1 dev vmnet1 - if [ -n "\$vmnet1nat" ] ; then - # needs refinement interface name for eth0 is known in stage3 already - echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null - echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null - #iptables -A -s vmnet1 -d eth0 - fi - fi - } - # incomplete ... - setup_vmnet8() { - if [ -n "\$vmnet8" ] ; then - test -c /dev/vmnet1 || mknod c 119 8 /dev/vmnet8 - # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 - $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\ - -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf - dhcpif="\$dhcpif vmnet8" - ip addr add \$vmnet8 dev vmnet8 - fi - } - runvmdhcpd() { - if [ -n "\$dhcpif" ] ; then - # the path might be directly point to the plugin dir - mkdir /var/run/vmware 2>/dev/null - $location/vmnet-dhcpd -cf /etc/vmware/dhcpd.conf -lf \\ - /var/run/vmware/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid \$dhcpif - fi - } - # initialize the lsb status messages - . /lib/lsb/init-functions - - case \$1 in - start) - log_daemon_msg "Starting vmware background services ..." "vmware" - # load the configuration file - . /etc/vmware/slxvmconfig - load_modules || log_warning_msg "The loading of vmware modules failed" - setup_vmnet0 || log_warning_msg "Problems setting up vmnet0 interface" - setup_vmnet1 || log_warning_msg "Problems setting up vmnet1 interface" - setup_vmnet8 || log_warning_msg "Problems setting up vmnet8 interface" - runvmdhcpd - log_end_msg $? - ;; - stop) - # message output should match the given vendor-os - log_daemon_msg "Stopping vmware background services ..." "vmware" - killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ - vmware-tray 2>/dev/null - # wait for shutting down of interfaces - usleep 50000 - unload_modules - log_end_msg $? - ;; - status) - log_daemon_msg "Say something useful here ..." - ;; - esac - exit 0 - End-of-Here - return $script; -} - -1; \ No newline at end of file -- cgit v1.2.3-55-g7522