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 --- initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm | 45 ------- initramfs/OpenSLX/MakeInitRamFS/Distro/Suse.pm | 45 +++++++ initramfs/OpenSLX/MakeInitRamFS/Engine.pm | 17 +-- installer/OpenSLX/OSExport/Distro/Any.pm | 4 +- installer/OpenSLX/OSExport/Distro/Base.pm | 5 +- installer/OpenSLX/OSExport/Distro/Debian.pm | 4 +- installer/OpenSLX/OSExport/Distro/Fedora.pm | 4 +- installer/OpenSLX/OSExport/Distro/Gentoo.pm | 4 +- installer/OpenSLX/OSExport/Distro/SUSE.pm | 113 ---------------- installer/OpenSLX/OSExport/Distro/Suse.pm | 113 ++++++++++++++++ installer/OpenSLX/OSExport/Distro/Ubuntu.pm | 4 +- installer/OpenSLX/OSExport/Engine.pm | 41 ++---- installer/OpenSLX/OSSetup/Distro/Any_Clone.pm | 4 +- installer/OpenSLX/OSSetup/Distro/Base.pm | 4 +- installer/OpenSLX/OSSetup/Distro/Debian.pm | 4 +- installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm | 4 +- installer/OpenSLX/OSSetup/Distro/Fedora.pm | 4 +- installer/OpenSLX/OSSetup/Distro/Gentoo.pm | 4 +- installer/OpenSLX/OSSetup/Distro/SUSE.pm | 85 ------------ installer/OpenSLX/OSSetup/Distro/Suse.pm | 85 ++++++++++++ installer/OpenSLX/OSSetup/Distro/Ubuntu.pm | 4 +- installer/OpenSLX/OSSetup/Engine.pm | 144 ++++++-------------- installer/slxos-setup | 2 +- lib/OpenSLX/Basics.pm | 77 ++++++++++- os-plugins/OpenSLX/OSPlugin/Base.pm | 2 +- os-plugins/OpenSLX/OSPlugin/Engine.pm | 40 +----- os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm | 16 ++- .../plugins/desktop/OpenSLX/Distro/Debian.pm | 31 +++++ .../plugins/desktop/OpenSLX/Distro/Fedora.pm | 30 +++++ .../plugins/desktop/OpenSLX/Distro/Gentoo.pm | 30 +++++ os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm | 39 ++++++ .../plugins/desktop/OpenSLX/Distro/Ubuntu.pm | 31 +++++ .../plugins/desktop/OpenSLX/Distro/debian.pm | 29 ---- .../plugins/desktop/OpenSLX/Distro/fedora.pm | 48 ------- .../plugins/desktop/OpenSLX/Distro/gentoo.pm | 58 -------- os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm | 28 ---- .../plugins/desktop/OpenSLX/Distro/ubuntu.pm | 28 ---- .../plugins/desktop/OpenSLX/OSPlugin/desktop.pm | 2 +- os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm | 63 +++++++++ os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm | 41 ++++++ .../plugins/syslog/OpenSLX/OSPlugin/syslog.pm | 30 +++-- .../syslog/init-hooks/15-have-ip-config/syslog.sh | 11 +- os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm | 2 +- 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 -------------------- 54 files changed, 1202 insertions(+), 1157 deletions(-) delete mode 100644 initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm create mode 100644 initramfs/OpenSLX/MakeInitRamFS/Distro/Suse.pm delete mode 100644 installer/OpenSLX/OSExport/Distro/SUSE.pm create mode 100644 installer/OpenSLX/OSExport/Distro/Suse.pm delete mode 100644 installer/OpenSLX/OSSetup/Distro/SUSE.pm create mode 100644 installer/OpenSLX/OSSetup/Distro/Suse.pm create mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm create mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm create mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm create mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm create mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm delete mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm delete mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/fedora.pm delete mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/gentoo.pm delete mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm delete mode 100644 os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm create mode 100644 os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm create mode 100644 os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm 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 diff --git a/initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm b/initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm deleted file mode 100644 index 991a2fd1..00000000 --- a/initramfs/OpenSLX/MakeInitRamFS/Distro/SUSE.pm +++ /dev/null @@ -1,45 +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/ -# ----------------------------------------------------------------------------- -# MakeInitRamFS::Distro::SUSE.pm -# - provides SUSE-specific overrides of the MakeInitRamFS::Distro API. -# ----------------------------------------------------------------------------- -package OpenSLX::MakeInitRamFS::Distro::SUSE; - -use strict; -use warnings; - -use base qw(OpenSLX::MakeInitRamFS::Distro::Base); - -use OpenSLX::Basics; - -################################################################################ -### implementation -################################################################################ -sub new -{ - my $class = shift; - my $self = { - 'base-name' => 'suse', - }; - return bless $self, $class; -} - -sub applyChanges -{ - my $self = shift; - my $engine = shift; - - $engine->_addFilteredKernelModules( qw( hid unix )); - - return; -} - -1; \ No newline at end of file diff --git a/initramfs/OpenSLX/MakeInitRamFS/Distro/Suse.pm b/initramfs/OpenSLX/MakeInitRamFS/Distro/Suse.pm new file mode 100644 index 00000000..991a2fd1 --- /dev/null +++ b/initramfs/OpenSLX/MakeInitRamFS/Distro/Suse.pm @@ -0,0 +1,45 @@ +# 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/ +# ----------------------------------------------------------------------------- +# MakeInitRamFS::Distro::SUSE.pm +# - provides SUSE-specific overrides of the MakeInitRamFS::Distro API. +# ----------------------------------------------------------------------------- +package OpenSLX::MakeInitRamFS::Distro::SUSE; + +use strict; +use warnings; + +use base qw(OpenSLX::MakeInitRamFS::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### implementation +################################################################################ +sub new +{ + my $class = shift; + my $self = { + 'base-name' => 'suse', + }; + return bless $self, $class; +} + +sub applyChanges +{ + my $self = shift; + my $engine = shift; + + $engine->_addFilteredKernelModules( qw( hid unix )); + + return; +} + +1; \ No newline at end of file diff --git a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm index 43374e9e..efa8d1de 100644 --- a/initramfs/OpenSLX/MakeInitRamFS/Engine.pm +++ b/initramfs/OpenSLX/MakeInitRamFS/Engine.pm @@ -58,18 +58,15 @@ sub new $self->{'system-name'} =~ m{^([^\-]+)-([^:\-]+)} or die "unable to extract distro-info from $self->{'system-name'}!"; - $self->{'distro-name'} = $1; + $self->{'distro-name'} = lc($1); $self->{'distro-ver'} = $2; - my %distroMap = ( - 'debian' => 'Debian', - 'suse' => 'SUSE', - 'ubuntu' => 'Ubuntu', - ); - my $distroModule = $distroMap{$self->{'distro-name'}} || 'Base'; - $self->{distro} = instantiateClass( - "OpenSLX::MakeInitRamFS::Distro::$distroModule" - ); + my $distroModule + = 'OpenSLX::MakeInitRamFS::Distro::' . ucfirst($self->{'distro-name'}); + if (!eval { $self->{distro} = instantiateClass($distroModule); }) { + $self->{distro} + = instantiateClass('OpenSLX::MakeInitRamFS::Distro::Base'); + } $self->{'lib-scanner'} = OpenSLX::LibScanner->new({ 'root-path' => $self->{'root-path'} }); diff --git a/installer/OpenSLX/OSExport/Distro/Any.pm b/installer/OpenSLX/OSExport/Distro/Any.pm index 59de2f32..b5f46366 100644 --- a/installer/OpenSLX/OSExport/Distro/Any.pm +++ b/installer/OpenSLX/OSExport/Distro/Any.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Any.pm -# - provides generic overrides of the OpenSLX OSExport API. +# OSExport/Distro/Any.pm +# - provides generic overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Any; diff --git a/installer/OpenSLX/OSExport/Distro/Base.pm b/installer/OpenSLX/OSExport/Distro/Base.pm index b6fc1fae..1b3edb63 100644 --- a/installer/OpenSLX/OSExport/Distro/Base.pm +++ b/installer/OpenSLX/OSExport/Distro/Base.pm @@ -8,9 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Base.pm -# - provides empty base of the distro-specific part of the OpenSLX -# OSExport API. +# OSExport/Distro/Base.pm +# - provides base implementation of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Base; diff --git a/installer/OpenSLX/OSExport/Distro/Debian.pm b/installer/OpenSLX/OSExport/Distro/Debian.pm index d1ae7d88..b764ab4f 100644 --- a/installer/OpenSLX/OSExport/Distro/Debian.pm +++ b/installer/OpenSLX/OSExport/Distro/Debian.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Debian.pm -# - provides Debian-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Debian.pm +# - provides Debian-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Debian; diff --git a/installer/OpenSLX/OSExport/Distro/Fedora.pm b/installer/OpenSLX/OSExport/Distro/Fedora.pm index 4e8c0bf0..4c196bd1 100644 --- a/installer/OpenSLX/OSExport/Distro/Fedora.pm +++ b/installer/OpenSLX/OSExport/Distro/Fedora.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Fedora.pm -# - provides Fedora-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Fedora.pm +# - provides Fedora-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Fedora; diff --git a/installer/OpenSLX/OSExport/Distro/Gentoo.pm b/installer/OpenSLX/OSExport/Distro/Gentoo.pm index 1df759dd..79fa2210 100644 --- a/installer/OpenSLX/OSExport/Distro/Gentoo.pm +++ b/installer/OpenSLX/OSExport/Distro/Gentoo.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Gentoo.pm -# - provides Gentoo-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Gentoo.pm +# - provides Gentoo-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Gentoo; diff --git a/installer/OpenSLX/OSExport/Distro/SUSE.pm b/installer/OpenSLX/OSExport/Distro/SUSE.pm deleted file mode 100644 index 7f5d5548..00000000 --- a/installer/OpenSLX/OSExport/Distro/SUSE.pm +++ /dev/null @@ -1,113 +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/ -# ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSExport API. -# ----------------------------------------------------------------------------- -package OpenSLX::OSExport::Distro::SUSE; - -use strict; -use warnings; - -use base qw(OpenSLX::OSExport::Distro::Base); - -use OpenSLX::Basics; - -################################################################################ -### implementation -################################################################################ -sub new -{ - my $class = shift; - my $self = { - 'base-name' => 'suse', - }; - return bless $self, $class; -} - -sub initDistroInfo -{ - my $self = shift; - - $self->{'export-filter'} = " - - /var/tmp/* - - /var/spool/* - - /var/run/* - - /var/mail - - /var/log/* - - /var/lock/* - - /var/lib/zypp/* - - /var/lib/zmd - - /var/lib/xdm - - /var/lib/vm* - - /var/lib/suspend* - - /var/lib/smart - - /var/lib/sax - - /var/lib/hardware/* - - /var/lib/gdm/* - - /var/lib/dhcp* - - /var/lib/bluetooth/ - - /var/lib/YaST2/you/mnt/* - - /var/lib/YaST2/backup_boot_sectors - - /var/cache/sax - - /var/cache/libx11/compose/* - - /var/cache/beagle - - /var/cache/yum - - /var/cache/man/* - - /var/adm/backup/rpmdb/* - - /var/adm/mount/AP* - - /var/adm/SuSEconfig - - /usr/share/vmware/* - - /usr/lib/zen-updater - + /usr/lib/python*/*/*.o - + /usr/lib/perl5/*/*/*/*.o - + /usr/lib/gcc/*/*/*.o - + /usr/lib/*.o - + /usr/X11R6/lib/modules/drivers/*.o - + /usr/X11R6/lib/modules/drivers/linux/*.o - - /usr/bin/zen-* - - /usr/bin/nw-manager - - /usr/X11R6/bin/BackGround - - /usr/bin/BackGround - - /tmp/* - - /sys/* - - /proc/* - - /opt/kde3/share/autostart/suseplugger.desktop - - /opt/kde3/share/autostart/susewatcher.desktop - - /opt/kde3/share/autostart/runupdater.desktop - - /opt/kde3/share/autostart/profile_chooser-autostart.desktop - - /opt/kde3/share/autostart/opensuseupdater.desktop - - /opt/kde3/share/autostart/knetworkmanager-autostart.desktop - - /opt/kde3/share/autostart/kerry.autostart.desktop - - /opt/kde3/share/autostart/kinternet.desktop - - /opt/kde3/share/autostart/beagled.desktop - - /opt/kde3/share/autostart/SUSEgreeter.desktop - - /opt/kde3/share/autostart/zen-updater-auto.desktop - - /opt/gnome/share/autostart/beagle*.desktop - - /mnt/* - - /media/* - + /media - + /lib/modules/*/misc/vmblock.o - + /lib/modules/*/misc/vmnet.o - + /lib/modules/*/misc/vmmon.o - - /etc/dhcpd.conf* - - /etc/cron.*/* - - /etc/sysconfig/network/ifcfg-* - - /etc/X11/xdm/SuSEconfig.xdm - - /boot/initrd* - - /boot/grub - - *.rpmsave - - *.rpmnew - - *.YaST2save - "; - return; -} - -1; diff --git a/installer/OpenSLX/OSExport/Distro/Suse.pm b/installer/OpenSLX/OSExport/Distro/Suse.pm new file mode 100644 index 00000000..c3392f11 --- /dev/null +++ b/installer/OpenSLX/OSExport/Distro/Suse.pm @@ -0,0 +1,113 @@ +# 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/ +# ----------------------------------------------------------------------------- +# OSExport/Distro/Suse.pm +# - provides SUSE-specific overrides of the OSExport Distro API. +# ----------------------------------------------------------------------------- +package OpenSLX::OSExport::Distro::Suse; + +use strict; +use warnings; + +use base qw(OpenSLX::OSExport::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### implementation +################################################################################ +sub new +{ + my $class = shift; + my $self = { + 'base-name' => 'suse', + }; + return bless $self, $class; +} + +sub initDistroInfo +{ + my $self = shift; + + $self->{'export-filter'} = " + - /var/tmp/* + - /var/spool/* + - /var/run/* + - /var/mail + - /var/log/* + - /var/lock/* + - /var/lib/zypp/* + - /var/lib/zmd + - /var/lib/xdm + - /var/lib/vm* + - /var/lib/suspend* + - /var/lib/smart + - /var/lib/sax + - /var/lib/hardware/* + - /var/lib/gdm/* + - /var/lib/dhcp* + - /var/lib/bluetooth/ + - /var/lib/YaST2/you/mnt/* + - /var/lib/YaST2/backup_boot_sectors + - /var/cache/sax + - /var/cache/libx11/compose/* + - /var/cache/beagle + - /var/cache/yum + - /var/cache/man/* + - /var/adm/backup/rpmdb/* + - /var/adm/mount/AP* + - /var/adm/SuSEconfig + - /usr/share/vmware/* + - /usr/lib/zen-updater + + /usr/lib/python*/*/*.o + + /usr/lib/perl5/*/*/*/*.o + + /usr/lib/gcc/*/*/*.o + + /usr/lib/*.o + + /usr/X11R6/lib/modules/drivers/*.o + + /usr/X11R6/lib/modules/drivers/linux/*.o + - /usr/bin/zen-* + - /usr/bin/nw-manager + - /usr/X11R6/bin/BackGround + - /usr/bin/BackGround + - /tmp/* + - /sys/* + - /proc/* + - /opt/kde3/share/autostart/suseplugger.desktop + - /opt/kde3/share/autostart/susewatcher.desktop + - /opt/kde3/share/autostart/runupdater.desktop + - /opt/kde3/share/autostart/profile_chooser-autostart.desktop + - /opt/kde3/share/autostart/opensuseupdater.desktop + - /opt/kde3/share/autostart/knetworkmanager-autostart.desktop + - /opt/kde3/share/autostart/kerry.autostart.desktop + - /opt/kde3/share/autostart/kinternet.desktop + - /opt/kde3/share/autostart/beagled.desktop + - /opt/kde3/share/autostart/SUSEgreeter.desktop + - /opt/kde3/share/autostart/zen-updater-auto.desktop + - /opt/gnome/share/autostart/beagle*.desktop + - /mnt/* + - /media/* + + /media + + /lib/modules/*/misc/vmblock.o + + /lib/modules/*/misc/vmnet.o + + /lib/modules/*/misc/vmmon.o + - /etc/dhcpd.conf* + - /etc/cron.*/* + - /etc/sysconfig/network/ifcfg-* + - /etc/X11/xdm/SuSEconfig.xdm + - /boot/initrd* + - /boot/grub + - *.rpmsave + - *.rpmnew + - *.YaST2save + "; + return; +} + +1; diff --git a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm index 0f60b63f..c488ffdf 100644 --- a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm +++ b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX OSExport API. +# OSExport/Distro/Ubuntu.pm +# - provides Ubuntu-specific overrides of the OSExport Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Ubuntu; diff --git a/installer/OpenSLX/OSExport/Engine.pm b/installer/OpenSLX/OSExport/Engine.pm index 7aba36da..60777f07 100644 --- a/installer/OpenSLX/OSExport/Engine.pm +++ b/installer/OpenSLX/OSExport/Engine.pm @@ -24,7 +24,7 @@ use Exporter; @EXPORT = qw( %supportedExportFileSystems %supportedExportBlockDevices - @supportedExportTypes %supportedDistros + @supportedExportTypes ); use File::Basename; @@ -34,7 +34,7 @@ use OpenSLX::Utils; our ( %supportedExportFileSystems, %supportedExportBlockDevices, - @supportedExportTypes, %supportedDistros + @supportedExportTypes, ); %supportedExportFileSystems = ( @@ -55,15 +55,6 @@ our ( 'sqfs-nbd', ); -%supportedDistros = ( - '' => {module => 'Any'}, - 'debian' => {module => 'Debian'}, - 'fedora' => {module => 'Fedora'}, - 'gentoo' => {module => 'Gentoo'}, - 'suse' => {module => 'SUSE'}, - 'ubuntu' => {module => 'Ubuntu'}, -); - ################################################################################ ### interface methods ################################################################################ @@ -213,25 +204,21 @@ sub _initialize $self->{'export-name'} = $exportName; $self->{'export-type'} = $exportType; $vendorOSName =~ m[^(.+?\-[^-]+)]; - my $distroName = $1; - $self->{'distro-name'} = $distroName; + $self->{'distro-name'} = lc($1); + my $distroName = ucfirst(lc($1)); # load module for the requested distro: - if (!exists $supportedDistros{lc($distroName)}) { - # try without _x86_64: - $distroName =~ s[_x86_64$][]; - if (!exists $supportedDistros{lc($distroName)}) { - # try basic distro-type (e.g. debian or suse): - $distroName =~ s[-.+$][]; - if (!exists $supportedDistros{lc($distroName)}) { - # fallback to generic implementation: - $distroName = ''; - } - } + my $distro = loadDistroModule({ + distroName => $distroName, + distroScope => 'OpenSLX::OSExport::Distro', + fallbackName => 'Any', + }); + if (!$distro) { + die _tr( + 'unable to load any OSExport::Distro module for vendor-OS %s!', + $vendorOSName + ); } - my $distroModuleName = $supportedDistros{lc($distroName)}->{module}; - my $distro = - instantiateClass("OpenSLX::OSExport::Distro::$distroModuleName"); $distro->initialize($self); $self->{distro} = $distro; diff --git a/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm b/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm index 005c0355..43385a29 100644 --- a/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm +++ b/installer/OpenSLX/OSSetup/Distro/Any_Clone.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Any_Clone.pm -# - provides generic clone-only overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Any_Clone.pm +# - provides generic clone-only overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Any_Clone; diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm index 573114e8..bcc331bb 100644 --- a/installer/OpenSLX/OSSetup/Distro/Base.pm +++ b/installer/OpenSLX/OSSetup/Distro/Base.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Base.pm -# - provides empty base of the OpenSLX OSSetup API. +# OSSetup/Distro/Base.pm +# - provides base implementation of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Base; diff --git a/installer/OpenSLX/OSSetup/Distro/Debian.pm b/installer/OpenSLX/OSSetup/Distro/Debian.pm index c8c02cdd..85f72d4f 100644 --- a/installer/OpenSLX/OSSetup/Distro/Debian.pm +++ b/installer/OpenSLX/OSSetup/Distro/Debian.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Debian.pm -# - provides Debian-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Debian.pm +# - provides Debian-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Debian; diff --git a/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm b/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm index e6ea3722..03c6fdf9 100644 --- a/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm +++ b/installer/OpenSLX/OSSetup/Distro/Debian_3_1.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Debian_3_1.pm -# - provides Debian-3.1-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Debian_3_1.pm +# - provides Debian-3.1-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Debian_3_1; diff --git a/installer/OpenSLX/OSSetup/Distro/Fedora.pm b/installer/OpenSLX/OSSetup/Distro/Fedora.pm index 0bc9ebdc..80480340 100644 --- a/installer/OpenSLX/OSSetup/Distro/Fedora.pm +++ b/installer/OpenSLX/OSSetup/Distro/Fedora.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Fedora.pm -# - provides Fedora-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Fedora.pm +# - provides Fedora-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Fedora; diff --git a/installer/OpenSLX/OSSetup/Distro/Gentoo.pm b/installer/OpenSLX/OSSetup/Distro/Gentoo.pm index c49ba5d6..1f1e0577 100644 --- a/installer/OpenSLX/OSSetup/Distro/Gentoo.pm +++ b/installer/OpenSLX/OSSetup/Distro/Gentoo.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Gentoo.pm +# - provides Gentoo-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Gentoo; diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE.pm b/installer/OpenSLX/OSSetup/Distro/SUSE.pm deleted file mode 100644 index 192ea3aa..00000000 --- a/installer/OpenSLX/OSSetup/Distro/SUSE.pm +++ /dev/null @@ -1,85 +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/ -# ----------------------------------------------------------------------------- -# SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSSetup API. -# ----------------------------------------------------------------------------- -package OpenSLX::OSSetup::Distro::SUSE; - -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} || 'smart'; - - if ($engine->{'action-type'} eq 'install') { - # Inform SUSE RPMs that we're performing an installation - this is - # only important for installations taking place in stage 1c: - $ENV{YAST_IS_RUNNING} = "instsys"; - } - - return; -} - -sub fixPrerequiredFiles -{ - my $self = shift; - my $stage1cDir = shift; - - chown(0, 0, "$stage1cDir/etc/group", "$stage1cDir/etc/passwd", - "$stage1cDir/etc/shadow"); - return; -} - -sub updateDistroConfig -{ - my $self = shift; - - # invoke SuSEconfig in order to allow it to update the configuration: - if (slxsystem('SuSEconfig')) { - die _tr("unable to run SuSEconfig (%s)", $!); - } - $self->SUPER::updateDistroConfig(); - return; -} - -sub hashPassword -{ - my $self = shift; - my $password = shift; - - my $busyboxBin = $self->{engine}->{'busybox-binary'}; - my $hashedPassword = qx{$busyboxBin cryptpw -a blowfish '$password'}; - chomp $hashedPassword; - - return $hashedPassword; -} - -1; diff --git a/installer/OpenSLX/OSSetup/Distro/Suse.pm b/installer/OpenSLX/OSSetup/Distro/Suse.pm new file mode 100644 index 00000000..97da4f70 --- /dev/null +++ b/installer/OpenSLX/OSSetup/Distro/Suse.pm @@ -0,0 +1,85 @@ +# 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/ +# ----------------------------------------------------------------------------- +# OSSetup/Distro/Suse.pm +# - provides SUSE-specific overrides of the OSSetup Distro API. +# ----------------------------------------------------------------------------- +package OpenSLX::OSSetup::Distro::Suse; + +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} || 'smart'; + + if ($engine->{'action-type'} eq 'install') { + # Inform SUSE RPMs that we're performing an installation - this is + # only important for installations taking place in stage 1c: + $ENV{YAST_IS_RUNNING} = "instsys"; + } + + return; +} + +sub fixPrerequiredFiles +{ + my $self = shift; + my $stage1cDir = shift; + + chown(0, 0, "$stage1cDir/etc/group", "$stage1cDir/etc/passwd", + "$stage1cDir/etc/shadow"); + return; +} + +sub updateDistroConfig +{ + my $self = shift; + + # invoke SuSEconfig in order to allow it to update the configuration: + if (slxsystem('SuSEconfig')) { + die _tr("unable to run SuSEconfig (%s)", $!); + } + $self->SUPER::updateDistroConfig(); + return; +} + +sub hashPassword +{ + my $self = shift; + my $password = shift; + + my $busyboxBin = $self->{engine}->{'busybox-binary'}; + my $hashedPassword = qx{$busyboxBin cryptpw -a blowfish '$password'}; + chomp $hashedPassword; + + return $hashedPassword; +} + +1; diff --git a/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm b/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm index c0660818..a2a397ed 100644 --- a/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm +++ b/installer/OpenSLX/OSSetup/Distro/Ubuntu.pm @@ -8,8 +8,8 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX OSSetup API. +# OSSetup/Distro/Ubuntu.pm +# - provides Ubuntu-specific overrides of the OSSetup Distro API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Ubuntu; diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index 76adeaa6..503b10cb 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -38,84 +38,32 @@ use OpenSLX::Utils; use vars qw(%supportedDistros); %supportedDistros = ( - 'debian-3.1' => { - module => 'Debian_3_1', support => 'clone,install' - }, - 'debian-4.0' => { - module => 'Debian', support => 'clone,install' - }, - 'debian-4.0_amd64' => { - module => 'Debian', support => 'clone,install' - }, - 'fedora-6' => { - module => 'Fedora', support => 'clone,install' - }, - 'fedora-6_x86_64' => { - module => 'Fedora', support => 'clone,install' - }, - 'gentoo-2006.X' => { - module => 'Gentoo', support => 'clone' - }, - 'gentoo-2007.X' => { - module => 'Gentoo', support => 'clone' - }, - 'mandriva-2007.0' => { - module => 'Mandriva_2007_0', support => 'clone' - }, - 'suse-9.3' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.0' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.0_x86_64' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.1' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.1_x86_64' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.2' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.2_x86_64' => { - module => 'SUSE', support => 'clone,install' - }, - 'suse-10.3' => { - module => 'SUSE', support => 'clone' - }, - 'suse-10.3_x86_64' => { - module => 'SUSE', support => 'clone' - }, - 'ubuntu-6.06' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-6.10' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-6.10_amd64' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-7.04' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-7.04_amd64' => { - module => 'Ubuntu', support => 'clone,install' - }, - 'ubuntu-7.10' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-7.10_amd64' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-8.04' => { - module => 'Ubuntu', support => 'clone' - }, - 'ubuntu-8.04_amd64' => { - module => 'Ubuntu', support => 'clone' - }, + 'debian-3.1' => 'clone,install', + 'debian-4.0' => 'clone,install', + 'debian-4.0_amd64' => 'clone,install', + 'fedora-6' => 'clone,install', + 'fedora-6_x86_64' => 'clone,install', + 'gentoo-2006.X' => 'clone', + 'gentoo-2007.X' => 'clone', + 'mandriva-2007.0' => 'clone', + 'suse-9.3' => 'clone', + 'suse-10.0' => 'clone', + 'suse-10.0_x86_64' => 'clone', + 'suse-10.1' => 'clone,install', + 'suse-10.1_x86_64' => 'clone,install', + 'suse-10.2' => 'clone,install', + 'suse-10.2_x86_64' => 'clone,install', + 'suse-10.3' => 'clone', + 'suse-10.3_x86_64' => 'clone', + 'ubuntu-6.06' => 'clone', + 'ubuntu-6.10' => 'clone,install', + 'ubuntu-6.10_amd64' => 'clone,install', + 'ubuntu-7.04' => 'clone,install', + 'ubuntu-7.04_amd64' => 'clone,install', + 'ubuntu-7.10' => 'clone', + 'ubuntu-7.10_amd64' => 'clone', + 'ubuntu-8.04' => 'clone', + 'ubuntu-8.04_amd64' => 'clone', ); my %localHttpServers; @@ -146,20 +94,20 @@ sub initialize "Given vendor-OS has unknown format, expected '-[-]'\n" ); } - my $distroName = $1; + my $distroName = lc($1); my $selectionName = $2 || 'default'; $self->{'vendor-os-name'} = $vendorOSName; $self->{'action-type'} = $actionType; - $self->{'distro-name'} = lc($distroName); + $self->{'distro-name'} = $distroName; $self->{'selection-name'} = $selectionName; $self->{'clone-source'} = ''; - if (!exists $supportedDistros{lc($distroName)}) { + if (!exists $supportedDistros{$distroName}) { print _tr("Sorry, distro '%s' is unsupported.\n", $distroName); print _tr("List of supported distros:\n\t"); print join("\n\t", sort keys %supportedDistros) . "\n"; exit 1; } - my $support = $supportedDistros{lc($distroName)}->{support}; + my $support = $supportedDistros{$distroName}; if ($support !~ m[install]i) { if ($actionType eq 'install') { print _tr( @@ -185,22 +133,16 @@ sub initialize } # load module for the requested distro: - my $distro; - my $distroClass = $supportedDistros{lc($distroName)}->{module}; - if ($actionType =~ m{^(install|update|shell)}) { - $distro = instantiateClass("OpenSLX::OSSetup::Distro::$distroClass"); - } - else { - if (!eval { - $distro = instantiateClass("OpenSLX::OSSetup::Distro::$distroClass") - }) { - vlog(2, "could not load distro module '$distroClass' ($@) ..."); - vlog(2, "falling back to module 'Any_Clone'"); - # allow fallback to generic clone module, such that we can clone - # distro's for which there is no specific distro-module yet - # (like for example for Gentoo): - $distro = instantiateClass("OpenSLX::OSSetup::Distro::Any_Clone") - } + my $distro = loadDistroModule({ + distroName => $distroName, + distroScope => 'OpenSLX::OSSetup::Distro', + fallbackName => 'Any_Clone', + }); + if (!$distro) { + die _tr( + 'unable to load any OSSetup::Distro module for vendor-OS %s!', + $vendorOSName + ); } $distro->initialize($self); @@ -1707,10 +1649,12 @@ sub _clone_fetchSource ) ); print $rsyncFH $excludeIncludeList; - close($rsyncFH) - or croak _tr( + if (!close($rsyncFH)) { + print "rsync-result=", 0+$!, "\n"; + croak _tr( "unable to clone from source '%s', giving up! (%s)\n", $source, $! ); + } return; } diff --git a/installer/slxos-setup b/installer/slxos-setup index 5e9bf650..e5e44d58 100755 --- a/installer/slxos-setup +++ b/installer/slxos-setup @@ -160,7 +160,7 @@ if ($action =~ m[^import]i) { print join('', map { "\t$_" .(' 'x(20-length($_))) - ."\t($supportedDistros{$_}->{support})\n" + ."\t($supportedDistros{$_})\n" } sort keys %supportedDistros); } elsif ($action =~ m[^list-in]i) { diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm index 9af056e6..e46f57f0 100644 --- a/lib/OpenSLX/Basics.pm +++ b/lib/OpenSLX/Basics.pm @@ -29,7 +29,7 @@ $VERSION = 1.01; &callInSubprocess &executeInSubprocess &slxsystem &vlog &checkParams - &instantiateClass + &instantiateClass &loadDistroModule ); our (%openslxConfig, %cmdlineConfig, %openslxPath); @@ -561,18 +561,23 @@ sub instantiateClass my $flags = shift || {}; checkParams($flags, { - 'acceptMissing' => '?', - 'pathToClass' => '?', + 'acceptMissing' => '?', + 'pathToClass' => '?', + 'incPaths' => '?', 'version' => '?', }); my $pathToClass = $flags->{pathToClass}; my $requestedVersion = $flags->{version}; + my $incPaths = $flags->{incPaths} || []; my $moduleName = defined $pathToClass ? "$pathToClass/$class" : $class; $moduleName =~ s[::][/]g; $moduleName .= '.pm'; - if (!eval { require $moduleName } ) { + vlog(3, "trying to load $moduleName..."); + my @originalINC = @INC; + if (!eval { unshift @INC, @$incPaths; require $moduleName; 1 } ) { + @INC = @originalINC; # check if module does not exists anywhere in search path if (!-e $moduleName) { return if $flags->{acceptMissing}; @@ -581,6 +586,7 @@ sub instantiateClass # some other error (probably compilation problems) die _tr("Unable to load module '%s' (%s)\n", $moduleName, $@); } + @INC = @originalINC; if (defined $requestedVersion) { my $classVersion = $class->VERSION; if ($classVersion < $requestedVersion) { @@ -592,4 +598,67 @@ sub instantiateClass return $class->new; } +sub loadDistroModule +{ + my $params = shift; + + checkParams($params, { + 'distroName' => '!', + 'distroScope' => '!', + 'fallbackName' => '?', + 'pathToClass' => '?', + }); + my $distroName = ucfirst(lc($params->{distroName})); + my $distroScope = $params->{distroScope}; + my $fallbackName = $params->{fallbackName} || 'Base'; + my $pathToClass = $params->{pathToClass}; + + vlog(1, "finding a ${distroScope} module for $distroName ..."); + + # try to load the distro module starting with the given name and then + # working the way upwards (from most specific to generic). + # When given 'suse-10.3_x86_64', this would try the following modules: + # Suse_10_3_x86_64 + # Suse_10_3_x86 (pretty senseless, but what the heck ...) + # Suse_10_3 + # Suse_10 + # Suse + # Base (or whatever has been given as fallback name) + $distroName =~ tr{.-}{__}; + my @distroModules; + while($distroName =~ m{^(.+)_[^_]*$}) { + push @distroModules, $distroName; + $distroName = $1; + } + push @distroModules, $distroName; + push @distroModules, $fallbackName; + + my $pluginBasePath = "$openslxConfig{'base-path'}/lib/plugins"; + + my $distro; + for my $distroModule (@distroModules) { + my $loaded = eval { + vlog(1, "trying ${distroScope}::$distroModule ..."); + my $flags = { acceptMissing => 1 }; + if ($pathToClass) { + $flags->{pathToClass} = $pathToClass; + $flags->{incPaths} = [ $pathToClass ]; + } + $distro = instantiateClass("${distroScope}::$distroModule", $flags); + return 0 if !$distro; # module does not exist, try next + vlog(1, "ok - using ${distroScope}::$distroModule."); + 1; + }; + last if $loaded; + if (!defined $loaded) { + vlog(0, _tr( + "Error when trying to load distro module '%s':\n%s", + $distroModule, $@ + )); + } + } + + return $distro; +} + 1; diff --git a/os-plugins/OpenSLX/OSPlugin/Base.pm b/os-plugins/OpenSLX/OSPlugin/Base.pm index 9d4f6657..f974cdc0 100644 --- a/os-plugins/OpenSLX/OSPlugin/Base.pm +++ b/os-plugins/OpenSLX/OSPlugin/Base.pm @@ -303,7 +303,7 @@ sub copyRequiredFilesIntoInitramfs { my $self = shift; my $targetPath = shift; - my $attrs = shift; + my $attrs = shift; my $makeInitRamFSEngine = shift; return; diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index 6a587afd..091cd135 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -462,39 +462,13 @@ sub _loadPlugin # if there's a distro folder, instantiate the most appropriate distro class my $distro; if (-d "$self->{'plugin-path'}/OpenSLX/Distro") { - unshift @INC, $self->{'plugin-path'}; - my $distroName = $self->distroName(); - $distroName =~ tr{.-}{__}; - my @distroModules; - while($distroName =~ m{^(.+)_[^_]*$}) { - push @distroModules, $distroName; - $distroName = $1; - } - push @distroModules, $distroName; - push @distroModules, 'Base'; - for my $distroModule (@distroModules) { - my $loaded = eval { - vlog(1, "trying distro-module $distroModule..."); - $distro = instantiateClass( - 'OpenSLX::Distro::' . $distroModule, - { - pathToClass => $self->{'plugin-path'}, - acceptMissing => 1, - } - ); - return 0 if !$distro; - vlog(1, "using $distroModule."); - 1; - }; - last if $loaded; - if (!defined $loaded) { - vlog(0, _tr( - "Error when trying to load distro module '%s':\n%s", - $distroModule, $@ - )); - } - } - shift @INC; + my $pluginBasePath = "$openslxConfig{'base-path'}/lib/plugins"; + my $distroScope = $plugin->{name} . '::OpenSLX::Distro'; + $distro = loadDistroModule({ + distroName => $self->distroName(), + distroScope => $distroScope, + pathToClass => $pluginBasePath, + }); if (!$distro) { die _tr( 'unable to load any distro module for vendor-OS %s in plugin %s', diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm index 3764de39..dffa1850 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/desktop/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 desktop -# plugin. +# desktop/OpenSLX/Distro/Base.pm +# - provides base implementation of the Distro API for the desktop plugin. # ----------------------------------------------------------------------------- -package OpenSLX::Distro::Base; +package desktop::OpenSLX::Distro::Base; use strict; use warnings; @@ -99,6 +98,15 @@ sub GDMPathInfo return $pathInfo; } +sub GDMRunlevelLinks +{ + my $self = shift; + + return unshiftHereDoc(<<" End-of-Here"); + rllinker gdm 15 15 + End-of-Here +} + sub GDMConfigHashForWorkstation { my $self = shift; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm new file mode 100644 index 00000000..361543e9 --- /dev/null +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm @@ -0,0 +1,31 @@ +# 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/ +# ----------------------------------------------------------------------------- +# desktop/OpenSLX/Distro/Debian.pm +# - provides Debian-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Debian; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +# TODO: implement! + +1; \ No newline at end of file diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm new file mode 100644 index 00000000..f9428aab --- /dev/null +++ b/os-plugins/plugins/desktop/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/ +# ----------------------------------------------------------------------------- +# desktop/OpenSLX/Distro/Fedora.pm +# - provides Fedora-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Fedora; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ + +# TODO: implement! + +1; \ No newline at end of file diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm new file mode 100644 index 00000000..129f4d08 --- /dev/null +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.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/ +# ----------------------------------------------------------------------------- +# desktop/OpenSLX/Distro/Gentoo.pm +# - provides Gentoo-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Gentoo; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ + +# TODO: implement! + +1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm new file mode 100644 index 00000000..2c3818cd --- /dev/null +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm @@ -0,0 +1,39 @@ +# 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/ +# ----------------------------------------------------------------------------- +# desktop/OpenSLX/Distro/Suse.pm +# - provides SUSE-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Suse; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +sub GDMRunlevelLinks +{ + my $self = shift; + + return unshiftHereDoc(<<" End-of-Here"); + rllinker earlygdm 1 15 + rllinker xdm 15 1 + End-of-Here +} + +1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm new file mode 100644 index 00000000..7cd8ebc7 --- /dev/null +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm @@ -0,0 +1,31 @@ +# 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/ +# ----------------------------------------------------------------------------- +# desktop/OpenSLX/Distro/Ubuntu.pm +# - provides Ubuntu-specific overrides of the distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Ubuntu; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +# TODO: implement! + +1; \ No newline at end of file diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm deleted file mode 100644 index 2d837629..00000000 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm +++ /dev/null @@ -1,29 +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/ -# ----------------------------------------------------------------------------- -# 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 -################################################################################ - -1; \ No newline at end of file diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/fedora.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/fedora.pm deleted file mode 100644 index 0bc9ebdc..00000000 --- a/os-plugins/plugins/desktop/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/desktop/OpenSLX/Distro/gentoo.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/gentoo.pm deleted file mode 100644 index c49ba5d6..00000000 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/gentoo.pm +++ /dev/null @@ -1,58 +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/ -# ----------------------------------------------------------------------------- -# 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 new -{ - my $class = shift; - my $self = {}; - return bless $self, $class; -} - -sub pickKernelFile -{ - my $self = shift; - my $kernelPath = shift; - - my $newestKernelFile; - my $newestKernelFileSortKey = ''; - foreach my $kernelFile (glob("$kernelPath/kernel-genkernel-x86-*")) { - next unless $kernelFile =~ m{ - x86-(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?-(\d+(?:\.\d+)?) - }x; - my $sortKey - = sprintf("%02d.%02d.%02d.%02d-%2.1f", $1, $2, $3, $4||0, $5); - if ($newestKernelFileSortKey lt $sortKey) { - $newestKernelFile = $kernelFile; - $newestKernelFileSortKey = $sortKey; - } - } - - if (!defined $newestKernelFile) { - die _tr("unable to pick a kernel-file from path '%s'!", $kernelPath); - } - return $newestKernelFile; -} - -1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm deleted file mode 100644 index e360e1b5..00000000 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm +++ /dev/null @@ -1,28 +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/ -# ----------------------------------------------------------------------------- -# 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; - -################################################################################ -### interface methods -################################################################################ - -1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm deleted file mode 100644 index c932f87f..00000000 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm +++ /dev/null @@ -1,28 +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 -################################################################################ - -1; \ No newline at end of file diff --git a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm index 046d0759..70f8d71c 100644 --- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm +++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm @@ -420,8 +420,8 @@ sub _setupGDMScript # written by OpenSLX-plugin 'desktop' mkdir -p $paths 2>/dev/null ln -sf $repoPath/gdm/\$desktop_mode/gdm.conf /mnt$configFile - rllinker gdm 1 15 End-of-Here + $script .= $self->{distro}->GDMRunlevelLinks(); spitFile("$repoPath/gdm/desktop.sh", $script); return; } diff --git a/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm b/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm new file mode 100644 index 00000000..dd599404 --- /dev/null +++ b/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm @@ -0,0 +1,63 @@ +# 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/ +# ----------------------------------------------------------------------------- +# syslog/OpenSLX/Distro/Base.pm +# - provides base implementation of the Distro API for the syslog plugin. +# ----------------------------------------------------------------------------- +package syslog::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; + $self->{engine} = shift; + + return 1; +} + +sub runlevelInfo +{ + my $self = shift; + my $attrs = shift; + + # most distros (well: Debian & Ubuntu) use a different initscript depending + # on which version of syslog is installed ('syslogd' or 'syslog-ng') + my $kind = lc($attrs->{'syslog::kind'}); + my %nameMap = ( + 'syslogd' => 'sysklogd', + 'syslog-ng' => 'syslog-ng', + ); + my $rlInfo = { + scriptName => $nameMap{$kind}, + startAt => 2, + stopAt => 15, + }; + + return $rlInfo; +} + +1; diff --git a/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm new file mode 100644 index 00000000..7255d6f5 --- /dev/null +++ b/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm @@ -0,0 +1,41 @@ +# 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/ +# ----------------------------------------------------------------------------- +# syslog/OpenSLX/Distro/Suse.pm +# - provides SUSE-specific overrides of the Distro API for the syslog plugin. +# ----------------------------------------------------------------------------- +package syslog::OpenSLX::Distro::Suse; + +use strict; +use warnings; + +use base qw(syslog::OpenSLX::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ + +sub runlevelInfo +{ + my $self = shift; + my $attrs = shift; + + my $rlInfo = $self->SUPER::runlevelInfo($attrs); + + # SUSE uses a script named 'syslog', no matter if syslogd or syslog-ng + # is installed + $rlInfo->{scriptName} = 'syslog'; + + return $rlInfo; +} + +1; diff --git a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm b/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm index 9220d3ab..e5e63c29 100644 --- a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm +++ b/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm @@ -92,6 +92,16 @@ sub getAttrInfo content_descr => 'a port number', default => 514, }, + 'syslog::file' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + name of file where all log messages shall be written + End-of-Here + content_regex => undef, + content_descr => 'a complete file path', + default => undef, + }, }; } @@ -170,7 +180,9 @@ sub _setupSyslogNG my $repoPath = $self->{pluginRepositoryPath}; - my $conf = unshiftHereDoc(<<' End-of-Here'); + my $rlInfo = $self->{distro}->runlevelInfo($attrs); + + my $conf = unshiftHereDoc(<<" End-of-Here"); #!/bin/ash # written by OpenSLX-plugin 'syslog' @@ -190,11 +202,11 @@ sub _setupSyslogNG }; END - if [ -n "${syslog_host}" ]; then - [ -z ${syslog_port} ] && syslog_port=514 + if [ -n "\${syslog_host}" ]; then + [ -z \${syslog_port} ] && syslog_port=514 cat >>/mnt/etc/syslog-ng/syslog-ng.conf <>/mnt/etc/syslog-ng/syslog-ng.conf <{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt} End-of-Here spitFile("$repoPath/syslog.sh", $conf); @@ -230,6 +242,8 @@ sub _setupSyslogd my $repoPath = $self->{pluginRepositoryPath}; + my $rlInfo = $self->{distro}->runlevelInfo($attrs); + # TODO: implement! my $conf = unshiftHereDoc(<<' End-of-Here'); @@ -237,7 +251,7 @@ sub _setupSyslogd # written by OpenSLX-plugin 'syslog' - rllinker syslogd 1 15 + rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt} End-of-Here spitFile("$repoPath/syslog.sh", $conf); diff --git a/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh b/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh index 4003a0a4..3c3a1d13 100644 --- a/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh +++ b/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh @@ -1,8 +1,13 @@ if [ -e /initramfs/plugin-conf/syslog.conf ]; then . /initramfs/plugin-conf/syslog.conf - if [ $syslog_active -ne 0 ] && [ -n "$syslog_host" ]; then - echo "syslogd -R ${syslog_host}:${syslog_port}..." - syslogd -R "${syslog_host}:${syslog_port}" & >/dev/null 2>&1 + if [ $syslog_active -ne 0 ]; then + # TODO: maybe limit the maximum log file size via rotation? + params="-s 0" + if [ -n "$syslog_host" ]; then + params="$params -R ${syslog_host}:${syslog_port}" + fi + echo "syslogd $params ..." + syslogd $params >/dev/null 2>&1 klogd >/dev/null 2>&1 fi fi diff --git a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm index 1de80d93..28cc943b 100644 --- a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm +++ b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm @@ -126,7 +126,7 @@ sub suggestAdditionalKernelModules # Ubuntu needs vesafb and fbcon (which drags along some others) if ($makeInitRamFSEngine->{'distro-name'} =~ m{^ubuntu}i) { - push @suggestedModules, qw( vesafb fbcon ) + push @suggestedModules, qw( vesafb fbcon ) } return @suggestedModules; 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