diff options
Diffstat (limited to 'os-plugins/plugins')
15 files changed, 1346 insertions, 1346 deletions
diff --git a/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm b/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm index 16345136..55e557f3 100644 --- a/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm +++ b/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # bootsplash.pm -# - implementation of the 'bootsplash' plugin, which installs splashy +# - implementation of the 'bootsplash' plugin, which installs splashy # into the ramfs, including changeing theme # ----------------------------------------------------------------------------- package OpenSLX::OSPlugin::bootsplash; @@ -24,138 +24,138 @@ use OpenSLX::Utils; sub new { - my $class = shift; + my $class = shift; - my $self = { - name => 'bootsplash', - }; + my $self = { + name => 'bootsplash', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; - - return { - description => unshiftHereDoc(<<' End-of-Here'), - Installs Splashy as bootsplash into ramfs and sets a Theme. - End-of-Here - mustRunAfter => [], - }; + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + Installs Splashy as bootsplash into ramfs and sets a Theme. + End-of-Here + mustRunAfter => [], + }; } sub getAttrInfo { - my $self = shift; - - return { - 'bootsplash::active' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'bootsplash'-plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - 'bootsplash::precedence' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'bootsplash' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 30, - }, - - 'bootsplash::theme' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - name of the theme to apply to bootsplash (unset for no theme) - End-of-Here - content_regex => undef, - content_descr => undef, - default => 'openslx', - }, - }; + my $self = shift; + + return { + 'bootsplash::active' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'bootsplash'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + 'bootsplash::precedence' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'bootsplash' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 30, + }, + + 'bootsplash::theme' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + name of the theme to apply to bootsplash (unset for no theme) + End-of-Here + content_regex => undef, + content_descr => undef, + default => 'openslx', + }, + }; } sub suggestAdditionalKernelParams { - my $self = shift; - my $makeInitRamFSEngine = shift; - - my @suggestedParams; - - # add vga=0x317 unless explicit vga-mode is already set - if (!$makeInitRamFSEngine->haveKernelParam(qr{\bvga=})) { - push @suggestedParams, 'vga=0x317'; - } - - # add quiet, if not already set - if (!$makeInitRamFSEngine->haveKernelParam('quiet')) { - push @suggestedParams, 'quiet'; - } - - return @suggestedParams; + my $self = shift; + my $makeInitRamFSEngine = shift; + + my @suggestedParams; + + # add vga=0x317 unless explicit vga-mode is already set + if (!$makeInitRamFSEngine->haveKernelParam(qr{\bvga=})) { + push @suggestedParams, 'vga=0x317'; + } + + # add quiet, if not already set + if (!$makeInitRamFSEngine->haveKernelParam('quiet')) { + push @suggestedParams, 'quiet'; + } + + return @suggestedParams; } sub suggestAdditionalKernelModules { - my $self = shift; - my $makeInitRamFSEngine = shift; - - my @suggestedModules; - - # Ubuntu needs vesafb and fbcon (which drags along some others) - if ($makeInitRamFSEngine->{'distro-name'} =~ m{^ubuntu}i) { - push @suggestedModules, qw( vesafb fbcon ) - } - - return @suggestedModules; + my $self = shift; + my $makeInitRamFSEngine = shift; + + my @suggestedModules; + + # Ubuntu needs vesafb and fbcon (which drags along some others) + if ($makeInitRamFSEngine->{'distro-name'} =~ m{^ubuntu}i) { + push @suggestedModules, qw( vesafb fbcon ) + } + + return @suggestedModules; } sub copyRequiredFilesIntoInitramfs { - my $self = shift; - my $targetPath = shift; - my $attrs = shift; - my $makeInitRamFSEngine = shift; - - my $themeDir = "$openslxConfig{'base-path'}/share/themes"; - my $bootsplashTheme = $attrs->{'bootsplash::theme'} || ''; - if ($bootsplashTheme) { - my $bootsplashThemeDir = "$themeDir/$bootsplashTheme/bootsplash"; - if (-d $bootsplashThemeDir) { - my $splashyPath = "$openslxConfig{'base-path'}/share/splashy"; - $makeInitRamFSEngine->addCMD( - "cp -p $splashyPath/* $targetPath/bin/" - ); - $makeInitRamFSEngine->addCMD( - "mkdir -p $targetPath/etc/splashy" - ); - $makeInitRamFSEngine->addCMD( - "cp -a $bootsplashThemeDir/* $targetPath/etc/splashy/" - ); - } - } - else { - $bootsplashTheme = '<none>'; - } - - vlog( - 1, - _tr( - "bootsplash-plugin: bootsplash=%s", - $bootsplashTheme - ) - ); - - return; + my $self = shift; + my $targetPath = shift; + my $attrs = shift; + my $makeInitRamFSEngine = shift; + + my $themeDir = "$openslxConfig{'base-path'}/share/themes"; + my $bootsplashTheme = $attrs->{'bootsplash::theme'} || ''; + if ($bootsplashTheme) { + my $bootsplashThemeDir = "$themeDir/$bootsplashTheme/bootsplash"; + if (-d $bootsplashThemeDir) { + my $splashyPath = "$openslxConfig{'base-path'}/share/splashy"; + $makeInitRamFSEngine->addCMD( + "cp -p $splashyPath/* $targetPath/bin/" + ); + $makeInitRamFSEngine->addCMD( + "mkdir -p $targetPath/etc/splashy" + ); + $makeInitRamFSEngine->addCMD( + "cp -a $bootsplashThemeDir/* $targetPath/etc/splashy/" + ); + } + } + else { + $bootsplashTheme = '<none>'; + } + + vlog( + 1, + _tr( + "bootsplash-plugin: bootsplash=%s", + $bootsplashTheme + ) + ); + + return; } 1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm index 37cfff46..3764de39 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm @@ -9,7 +9,7 @@ # 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 +# - provides empty base of the OpenSLX OSPlugin Distro API for the desktop # plugin. # ----------------------------------------------------------------------------- package OpenSLX::Distro::Base; @@ -17,7 +17,7 @@ package OpenSLX::Distro::Base; use strict; use warnings; -our $VERSION = 1.01; # API-version . implementation-version +our $VERSION = 1.01; # API-version . implementation-version use OpenSLX::Basics; use OpenSLX::Utils; @@ -27,204 +27,204 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = {}; - return bless $self, $class; + my $class = shift; + my $self = {}; + return bless $self, $class; } sub initialize { - my $self = shift; - $self->{engine} = shift; - - return 1; + my $self = shift; + $self->{engine} = shift; + + return 1; } sub isInPath { - my $self = shift; - my $binary = shift; - - my $path = qx{which $binary 2>/dev/null}; + my $self = shift; + my $binary = shift; + + my $path = qx{which $binary 2>/dev/null}; - return $path ? 1 : 0; + return $path ? 1 : 0; } sub isGNOMEInstalled { - my $self = shift; + my $self = shift; - return $self->isInPath('gnome-session'); + return $self->isInPath('gnome-session'); } sub isGDMInstalled { - my $self = shift; + my $self = shift; - return $self->isInPath('gdm'); + return $self->isInPath('gdm'); } sub installGNOME { - my $self = shift; + my $self = shift; - $self->{engine}->installPackages( - $self->{engine}->getInstallablePackagesForSelection('gnome') - ); + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('gnome') + ); - return 1; + return 1; } sub installGDM { - my $self = shift; + my $self = shift; - $self->{engine}->installPackages('gdm'); + $self->{engine}->installPackages('gdm'); - return 1; + return 1; } sub GDMPathInfo { - my $self = shift; - - my $pathInfo = { - config => '/etc/gdm/gdm.conf', - paths => [ - '/var/lib/gdm', - '/var/log/gdm', - ], - }; + my $self = shift; + + my $pathInfo = { + config => '/etc/gdm/gdm.conf', + paths => [ + '/var/lib/gdm', + '/var/log/gdm', + ], + }; - return $pathInfo; + return $pathInfo; } sub GDMConfigHashForWorkstation { - my $self = shift; - - return { - 'chooser' => { - }, - 'daemon' => { - AutomaticLoginEnable => 'false', - BaseXsession => '/etc/X11/Xsession', - Group => 'gdm', - User => 'gdm', - }, - 'debug' => { - Enable => 'false', - }, - 'greeter' => { - AllowShutdown => 'true', - Browser => 'false', - MinimalUID => '500', - SecureShutdown => 'false', - ShowDomain => 'false', - }, - 'gui' => { - }, - 'security' => { - AllowRemoteRoot => 'false', - DisallowTCP => 'true', - SupportAutomount => 'true', - }, - 'server' => { - }, - 'xdmcp' => { - Enable => 'false', - }, - }; + my $self = shift; + + return { + 'chooser' => { + }, + 'daemon' => { + AutomaticLoginEnable => 'false', + BaseXsession => '/etc/X11/Xsession', + Group => 'gdm', + User => 'gdm', + }, + 'debug' => { + Enable => 'false', + }, + 'greeter' => { + AllowShutdown => 'true', + Browser => 'false', + MinimalUID => '500', + SecureShutdown => 'false', + ShowDomain => 'false', + }, + 'gui' => { + }, + 'security' => { + AllowRemoteRoot => 'false', + DisallowTCP => 'true', + SupportAutomount => 'true', + }, + 'server' => { + }, + 'xdmcp' => { + Enable => 'false', + }, + }; } sub GDMConfigHashForKiosk { - my $self = shift; - - my $configHash = $self->GDMConfigHashForWorkstation(); + my $self = shift; + + my $configHash = $self->GDMConfigHashForWorkstation(); - $configHash->{daemon}->{AutomaticLoginEnable} = 'true'; - $configHash->{daemon}->{AutomaticLogin} = 'nobody'; + $configHash->{daemon}->{AutomaticLoginEnable} = 'true'; + $configHash->{daemon}->{AutomaticLogin} = 'nobody'; - return $configHash; + return $configHash; } sub GDMConfigHashForChooser { - my $self = shift; - - my $configHash = $self->GDMConfigHashForWorkstation(); - $configHash->{xdmcp}->{Enable} = 'true'; + my $self = shift; + + my $configHash = $self->GDMConfigHashForWorkstation(); + $configHash->{xdmcp}->{Enable} = 'true'; - return $configHash; + return $configHash; } sub isKDEInstalled { - my $self = shift; - - return $self->isInPath('startkde'); + my $self = shift; + + return $self->isInPath('startkde'); } sub isKDMInstalled { - my $self = shift; + my $self = shift; - return $self->isInPath('kdm'); + return $self->isInPath('kdm'); } sub installKDE { - my $self = shift; + my $self = shift; - $self->{engine}->installPackages( - $self->{engine}->getInstallablePackagesForSelection('kde') - ); + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('kde') + ); - return 1; + return 1; } sub installKDM { - my $self = shift; + my $self = shift; - $self->{engine}->installPackages('kdm'); + $self->{engine}->installPackages('kdm'); - return 1; + return 1; } sub isXFCEInstalled { - my $self = shift; + my $self = shift; - return $self->isInPath('startxfce4'); + return $self->isInPath('startxfce4'); } sub isXDMInstalled { - my $self = shift; + my $self = shift; - return $self->isInPath('xdm'); + return $self->isInPath('xdm'); } sub installXFCE { - my $self = shift; + my $self = shift; - $self->{engine}->installPackages( - $self->{engine}->getInstallablePackagesForSelection('xfce') - ); + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('xfce') + ); - return 1; + return 1; } sub installXDM { - my $self = shift; + my $self = shift; - $self->{engine}->installPackages('xdm'); + $self->{engine}->installPackages('xdm'); - return 1; + return 1; } 1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm index c5e6c5cd..2d837629 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # debian.pm -# - provides Debian-specific overrides of the OpenSLX Distro API for the +# - provides Debian-specific overrides of the OpenSLX Distro API for the # desktop plugin. # ----------------------------------------------------------------------------- package OpenSLX::Distro::debian; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/fedora.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/fedora.pm index 7fe4973c..0bc9ebdc 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/fedora.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/fedora.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Fedora.pm -# - provides Fedora-specific overrides of the OpenSLX OSSetup API. +# - provides Fedora-specific overrides of the OpenSLX OSSetup API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Fedora; @@ -25,24 +25,24 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = {}; - return bless $self, $class; + my $class = shift; + my $self = {}; + return bless $self, $class; } sub initialize { - my $self = shift; - my $engine = shift; + 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; + $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 index 4d1032f7..c49ba5d6 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/gentoo.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/gentoo.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSSetup API. +# - provides SUSE-specific overrides of the OpenSLX OSSetup API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::Distro::Gentoo; @@ -25,34 +25,34 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = {}; - return bless $self, $class; + 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; + 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 index 761a3705..e360e1b5 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm @@ -9,7 +9,7 @@ # 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 +# - provides SUSE-specific overrides of the OpenSLX Distro API for the desktop # plugin. # ----------------------------------------------------------------------------- package OpenSLX::Distro::suse; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm index 9982d363..c932f87f 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX OSSetup API. +# - provides Ubuntu-specific overrides of the OpenSLX OSSetup API. # ----------------------------------------------------------------------------- package OpenSLX::Distro::ubuntu; diff --git a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm index bef21fa9..9aa78d49 100644 --- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm +++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # desktop.pm -# - implementation of the 'desktop' plugin, which installs +# - implementation of the 'desktop' plugin, which installs # all needed information for a displaymanager and for the desktop. # ----------------------------------------------------------------------------- package OpenSLX::OSPlugin::desktop; @@ -27,449 +27,449 @@ use OpenSLX::Utils; sub new { - my $class = shift; + my $class = shift; - my $self = { - name => 'desktop', - }; + my $self = { + name => 'desktop', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; - - return { - description => unshiftHereDoc(<<' End-of-Here'), - Sets a desktop and creates needed configs, theme can be set as well. - End-of-Here - mustRunAfter => [], - }; + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + Sets a desktop and creates needed configs, theme can be set as well. + End-of-Here + mustRunAfter => [], + }; } sub getAttrInfo { - my $self = shift; - - return { - 'desktop::active' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'desktop'-plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - 'desktop::precedence' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'desktop' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 40, - }, - 'desktop::manager' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - which display manager to start: gdm, kdm or xdm? - End-of-Here - content_regex => qr{^(g|k|x)dm$}, - content_descr => 'allowed: gdm, kdm, xdm', - default => undef, - }, - 'desktop::kind' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - which desktop environment shall be used: gnome, kde, or xfce? - End-of-Here - content_regex => qr{^(gnome,kde,xfce)$}, - content_descr => 'allowed: gnome, kde, xfce', - default => undef, - }, - 'desktop::mode' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - which type of operation mode shall be activated: - workstattion, kiosk or chooser? - End-of-Here - content_regex => qr{^(workstation|kiosk|chooser)$}, - content_descr => 'allowed: workstation,kiosk,chooser', - default => 'workstation', - }, - 'desktop::theme' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - name of the theme to apply to the desktop (unset for no theme) - End-of-Here - content_descr => 'one of the entries in "supported_themes"', - default => 'openslx', - }, - 'desktop::supported_themes' => { - applies_to_vendor_os => 1, - description => unshiftHereDoc(<<' End-of-Here'), - name of all themes that shall be installed in vendor-OS (such - that they can be selected via 'desktop::theme' in stage 3). - End-of-Here - content_descr => 'a comma-separated list of theme names', - default => 'openslx,blue,circles', - }, - 'desktop::gdm' => { - applies_to_vendor_os => 1, - description => unshiftHereDoc(<<' End-of-Here'), - should gdm be available (installed in vendor-OS)? - End-of-Here - content_regex => qr{^0|1$}, - content_descr => '"0", "1" or "-" (for unset)', - default => undef, - }, - 'desktop::kdm' => { - applies_to_vendor_os => 1, - description => unshiftHereDoc(<<' End-of-Here'), - should kdm be available (installed in vendor-OS)? - End-of-Here - content_regex => qr{^0|1$}, - content_descr => '"0", "1" or "-" (for unset)', - default => undef, - }, - 'desktop::xdm' => { - applies_to_vendor_os => 1, - description => unshiftHereDoc(<<' End-of-Here'), - should xdm be available (installed in vendor-OS)? - End-of-Here - content_regex => qr{^0|1$}, - content_descr => '"0", "1" or "-" (for unset)', - default => undef, - }, - 'desktop::gnome' => { - applies_to_vendor_os => 1, - description => unshiftHereDoc(<<' End-of-Here'), - should gnome be available (installed in vendor-OS)? - End-of-Here - content_regex => qr{^0|1$}, - content_descr => '"0", "1" or "-" (for unset)', - default => undef, - }, - 'desktop::kde' => { - applies_to_vendor_os => 1, - description => unshiftHereDoc(<<' End-of-Here'), - should kde be available (installed in vendor-OS)? - End-of-Here - content_regex => qr{^0|1$}, - content_descr => '"0", "1" or "-" (for unset)', - default => undef, - }, - 'desktop::xfce' => { - applies_to_vendor_os => 1, - description => unshiftHereDoc(<<' End-of-Here'), - should xfce be available (installed in vendor-OS)? - End-of-Here - content_regex => qr{^0|1$}, - content_descr => '"0", "1" or "-" (for unset)', - default => undef, - }, - }; + my $self = shift; + + return { + 'desktop::active' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'desktop'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + 'desktop::precedence' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'desktop' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 40, + }, + 'desktop::manager' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + which display manager to start: gdm, kdm or xdm? + End-of-Here + content_regex => qr{^(g|k|x)dm$}, + content_descr => 'allowed: gdm, kdm, xdm', + default => undef, + }, + 'desktop::kind' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + which desktop environment shall be used: gnome, kde, or xfce? + End-of-Here + content_regex => qr{^(gnome,kde,xfce)$}, + content_descr => 'allowed: gnome, kde, xfce', + default => undef, + }, + 'desktop::mode' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + which type of operation mode shall be activated: + workstattion, kiosk or chooser? + End-of-Here + content_regex => qr{^(workstation|kiosk|chooser)$}, + content_descr => 'allowed: workstation,kiosk,chooser', + default => 'workstation', + }, + 'desktop::theme' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + name of the theme to apply to the desktop (unset for no theme) + End-of-Here + content_descr => 'one of the entries in "supported_themes"', + default => 'openslx', + }, + 'desktop::supported_themes' => { + applies_to_vendor_os => 1, + description => unshiftHereDoc(<<' End-of-Here'), + name of all themes that shall be installed in vendor-OS (such + that they can be selected via 'desktop::theme' in stage 3). + End-of-Here + content_descr => 'a comma-separated list of theme names', + default => 'openslx,blue,circles', + }, + 'desktop::gdm' => { + applies_to_vendor_os => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should gdm be available (installed in vendor-OS)? + End-of-Here + content_regex => qr{^0|1$}, + content_descr => '"0", "1" or "-" (for unset)', + default => undef, + }, + 'desktop::kdm' => { + applies_to_vendor_os => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should kdm be available (installed in vendor-OS)? + End-of-Here + content_regex => qr{^0|1$}, + content_descr => '"0", "1" or "-" (for unset)', + default => undef, + }, + 'desktop::xdm' => { + applies_to_vendor_os => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should xdm be available (installed in vendor-OS)? + End-of-Here + content_regex => qr{^0|1$}, + content_descr => '"0", "1" or "-" (for unset)', + default => undef, + }, + 'desktop::gnome' => { + applies_to_vendor_os => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should gnome be available (installed in vendor-OS)? + End-of-Here + content_regex => qr{^0|1$}, + content_descr => '"0", "1" or "-" (for unset)', + default => undef, + }, + 'desktop::kde' => { + applies_to_vendor_os => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should kde be available (installed in vendor-OS)? + End-of-Here + content_regex => qr{^0|1$}, + content_descr => '"0", "1" or "-" (for unset)', + default => undef, + }, + 'desktop::xfce' => { + applies_to_vendor_os => 1, + description => unshiftHereDoc(<<' End-of-Here'), + should xfce be available (installed in vendor-OS)? + End-of-Here + content_regex => qr{^0|1$}, + content_descr => '"0", "1" or "-" (for unset)', + default => undef, + }, + }; } sub getDefaultAttrsForVendorOS { - my $self = shift; - my $vendorOSName = shift; - - my $attrs = $self->getAttrInfo(); - - if ($vendorOSName =~ m{kde}) { - $attrs->{'desktop::manager'}->{default} = 'kdm'; - $attrs->{'desktop::kind'}->{default} = 'kde'; - } - elsif ($vendorOSName =~ m{gnome}) { - $attrs->{'desktop::manager'}->{default} = 'gdm'; - $attrs->{'desktop::kind'}->{default} = 'gnome'; - } - elsif ($vendorOSName =~ m{xfce}) { - $attrs->{'desktop::manager'}->{default} = 'xdm'; - $attrs->{'desktop::kind'}->{default} = 'xcfe'; - } - else { - # TODO: chroot into vendor-OS and determine the available desktop - } - return $attrs; + my $self = shift; + my $vendorOSName = shift; + + my $attrs = $self->getAttrInfo(); + + if ($vendorOSName =~ m{kde}) { + $attrs->{'desktop::manager'}->{default} = 'kdm'; + $attrs->{'desktop::kind'}->{default} = 'kde'; + } + elsif ($vendorOSName =~ m{gnome}) { + $attrs->{'desktop::manager'}->{default} = 'gdm'; + $attrs->{'desktop::kind'}->{default} = 'gnome'; + } + elsif ($vendorOSName =~ m{xfce}) { + $attrs->{'desktop::manager'}->{default} = 'xdm'; + $attrs->{'desktop::kind'}->{default} = 'xcfe'; + } + else { + # TODO: chroot into vendor-OS and determine the available desktop + } + return $attrs; } sub installationPhase { - my $self = shift; - - $self->{pluginRepositoryPath} = shift; - $self->{pluginTempPath} = shift; - $self->{openslxPath} = shift; - $self->{attrs} = shift; - - # We are going to change some of the stage1 attributes during installation - # (basically we are filling the ones that are not defined). Since the result - # of these changes might change between invocations, we do not want to store - # the resulting values, but we want to store the original (undef). - # In order to do so, we copy all stage1 attributes directly into the - # object hash and change them there. - $self->{gdm} = $self->{attrs}->{'desktop::gdm'}; - $self->{kdm} = $self->{attrs}->{'desktop::kdm'}; - $self->{xdm} = $self->{attrs}->{'desktop::xdm'}; - $self->{gnome} = $self->{attrs}->{'desktop::gnome'}; - $self->{kde} = $self->{attrs}->{'desktop::kde'}; - $self->{xcfe} = $self->{attrs}->{'desktop::xfce'}; - + my $self = shift; + + $self->{pluginRepositoryPath} = shift; + $self->{pluginTempPath} = shift; + $self->{openslxPath} = shift; + $self->{attrs} = shift; + + # We are going to change some of the stage1 attributes during installation + # (basically we are filling the ones that are not defined). Since the result + # of these changes might change between invocations, we do not want to store + # the resulting values, but we want to store the original (undef). + # In order to do so, we copy all stage1 attributes directly into the + # object hash and change them there. + $self->{gdm} = $self->{attrs}->{'desktop::gdm'}; + $self->{kdm} = $self->{attrs}->{'desktop::kdm'}; + $self->{xdm} = $self->{attrs}->{'desktop::xdm'}; + $self->{gnome} = $self->{attrs}->{'desktop::gnome'}; + $self->{kde} = $self->{attrs}->{'desktop::kde'}; + $self->{xcfe} = $self->{attrs}->{'desktop::xfce'}; + use Data::Dumper; print Dumper $self->{attrs}; - $self->_installRequiredPackages(); - $self->_fillUnsetStage1Attrs(); - $self->_ensureSensibleStage3Attrs(); + $self->_installRequiredPackages(); + $self->_fillUnsetStage1Attrs(); + $self->_ensureSensibleStage3Attrs(); use Data::Dumper; print Dumper $self->{attrs}; - # start to actually do something - according to current stage1 attributes - if ($self->{gdm}) { - $self->_setupGDM(); - } - if ($self->{kdm}) { - $self->_setupKDM(); - } - if ($self->{xdm}) { - $self->_setupXDM(); - } - - return; + # start to actually do something - according to current stage1 attributes + if ($self->{gdm}) { + $self->_setupGDM(); + } + if ($self->{kdm}) { + $self->_setupKDM(); + } + if ($self->{xdm}) { + $self->_setupXDM(); + } + + return; } sub removalPhase { - my $self = shift; - my $pluginRepositoryPath = shift; - my $pluginTempPath = shift; + my $self = shift; + my $pluginRepositoryPath = shift; + my $pluginTempPath = shift; - return; + return; } sub copyRequiredFilesIntoInitramfs { - my $self = shift; - my $targetPath = shift; - my $attrs = shift; - my $makeInitRamFSEngine = shift; - - my $themeDir = "$openslxConfig{'base-path'}/share/themes"; + my $self = shift; + my $targetPath = shift; + my $attrs = shift; + my $makeInitRamFSEngine = shift; + + my $themeDir = "$openslxConfig{'base-path'}/share/themes"; my $desktopXdmcp = $attrs->{'desktop::xdmcp'} || ''; - my $xdmcpConfigDir = "$openslxConfig{'base-path'}/lib/plugins/desktop/files/$desktopXdmcp"; - my $desktopTheme = $attrs->{'desktop::theme'} || ''; - if ($desktopTheme) { - my $desktopThemeDir - = "$themeDir/$desktopTheme/desktop/$desktopXdmcp"; - if (-d $desktopThemeDir) { + my $xdmcpConfigDir = "$openslxConfig{'base-path'}/lib/plugins/desktop/files/$desktopXdmcp"; + my $desktopTheme = $attrs->{'desktop::theme'} || ''; + if ($desktopTheme) { + my $desktopThemeDir + = "$themeDir/$desktopTheme/desktop/$desktopXdmcp"; + if (-d $desktopThemeDir) { $makeInitRamFSEngine->addCMD( "mkdir -p $targetPath/usr/share/files" ); - $makeInitRamFSEngine->addCMD( - "mkdir -p $targetPath/usr/share/themes" - ); - $makeInitRamFSEngine->addCMD( - "cp -a $desktopThemeDir $targetPath/usr/share/themes/" - ); + $makeInitRamFSEngine->addCMD( + "mkdir -p $targetPath/usr/share/themes" + ); + $makeInitRamFSEngine->addCMD( + "cp -a $desktopThemeDir $targetPath/usr/share/themes/" + ); $makeInitRamFSEngine->addCMD( "cp -a $xdmcpConfigDir $targetPath/usr/share/files" ); - } - } - else { - $desktopTheme = '<none>'; - } - - vlog( - 1, - _tr( - "desktop-plugin: desktop=%s", - $desktopTheme - ) - ); - - return; + } + } + else { + $desktopTheme = '<none>'; + } + + vlog( + 1, + _tr( + "desktop-plugin: desktop=%s", + $desktopTheme + ) + ); + + return; } sub _installRequiredPackages { - my $self = shift; - - my $engine = $self->{'os-plugin-engine'}; - - if ($self->{'gnome'} && !$self->{distro}->isGNOMEInstalled()) { - $self->{distro}->installGNOME(); - } - if ($self->{'gdm'} && !$self->{distro}->isGDMInstalled()) { - $self->{distro}->installGDM(); - } - if ($self->{'kde'} && !$self->{distro}->isKDEInstalled()) { - $self->{distro}->installKDE(); - } - if ($self->{'kdm'} && !$self->{distro}->isKDMInstalled()) { - $self->{distro}->installKDM(); - } - if ($self->{'xfce'} && !$self->{distro}->isXFCEInstalled()) { - $self->{distro}->installXFCE(); - } - if ($self->{'xdm'} && !$self->{distro}->isXDMInstalled()) { - $self->{distro}->installXDM(); - } - - return 1; + my $self = shift; + + my $engine = $self->{'os-plugin-engine'}; + + if ($self->{'gnome'} && !$self->{distro}->isGNOMEInstalled()) { + $self->{distro}->installGNOME(); + } + if ($self->{'gdm'} && !$self->{distro}->isGDMInstalled()) { + $self->{distro}->installGDM(); + } + if ($self->{'kde'} && !$self->{distro}->isKDEInstalled()) { + $self->{distro}->installKDE(); + } + if ($self->{'kdm'} && !$self->{distro}->isKDMInstalled()) { + $self->{distro}->installKDM(); + } + if ($self->{'xfce'} && !$self->{distro}->isXFCEInstalled()) { + $self->{distro}->installXFCE(); + } + if ($self->{'xdm'} && !$self->{distro}->isXDMInstalled()) { + $self->{distro}->installXDM(); + } + + return 1; } sub _fillUnsetStage1Attrs { - my $self = shift; - - if (!defined $self->{'gnome'}) { - $self->{'gnome'} = $self->{distro}->isGNOMEInstalled(); - } - if (!defined $self->{'gdm'}) { - $self->{'gdm'} = $self->{distro}->isGDMInstalled(); - } - if (!defined $self->{'kde'}) { - $self->{'kde'} = $self->{distro}->isKDEInstalled(); - } - if (!defined $self->{'kdm'}) { - $self->{'kdm'} = $self->{distro}->isKDMInstalled(); - } - if (!defined $self->{'xfce'}) { - $self->{'xfce'} = $self->{distro}->isXFCEInstalled(); - } - if (!defined $self->{'xdm'}) { - $self->{'xdm'} = $self->{distro}->isXDMInstalled(); - } - - return 1; + my $self = shift; + + if (!defined $self->{'gnome'}) { + $self->{'gnome'} = $self->{distro}->isGNOMEInstalled(); + } + if (!defined $self->{'gdm'}) { + $self->{'gdm'} = $self->{distro}->isGDMInstalled(); + } + if (!defined $self->{'kde'}) { + $self->{'kde'} = $self->{distro}->isKDEInstalled(); + } + if (!defined $self->{'kdm'}) { + $self->{'kdm'} = $self->{distro}->isKDMInstalled(); + } + if (!defined $self->{'xfce'}) { + $self->{'xfce'} = $self->{distro}->isXFCEInstalled(); + } + if (!defined $self->{'xdm'}) { + $self->{'xdm'} = $self->{distro}->isXDMInstalled(); + } + + return 1; } sub _ensureSensibleStage3Attrs { - my $self = shift; - - # check if current desktop kind is enabled at all and select another - # one, if it isn't - my $kind = $self->{attrs}->{'desktop::kind'} || ''; - if (!$self->{$kind}) { - my @desktops = map { $self->{$_} ? $_ : () } qw( gnome kde xfce ); - if (!@desktops) { - die _tr( - "no desktop kind is possible, plugin 'desktop' wouldn't work!" - ); - } - $self->{attrs}->{'desktop::kind'} = $desktops[0]; - } - - # check if current desktop manager is enabled at all and select another - # one, if it isn't - my $manager = $self->{attrs}->{'desktop::manager'} || ''; - if (!$self->{$manager}) { - my @managers = map { $self->{$_} ? $_ : () } qw( gdm kdm xdm ); - if (!@managers) { - die _tr( - "no desktop manager is possible, plugin 'desktop' wouldn't work!" - ); - } - $self->{attrs}->{'desktop::manager'} = $managers[0]; - } - - return 1; + my $self = shift; + + # check if current desktop kind is enabled at all and select another + # one, if it isn't + my $kind = $self->{attrs}->{'desktop::kind'} || ''; + if (!$self->{$kind}) { + my @desktops = map { $self->{$_} ? $_ : () } qw( gnome kde xfce ); + if (!@desktops) { + die _tr( + "no desktop kind is possible, plugin 'desktop' wouldn't work!" + ); + } + $self->{attrs}->{'desktop::kind'} = $desktops[0]; + } + + # check if current desktop manager is enabled at all and select another + # one, if it isn't + my $manager = $self->{attrs}->{'desktop::manager'} || ''; + if (!$self->{$manager}) { + my @managers = map { $self->{$_} ? $_ : () } qw( gdm kdm xdm ); + if (!@managers) { + die _tr( + "no desktop manager is possible, plugin 'desktop' wouldn't work!" + ); + } + $self->{attrs}->{'desktop::manager'} = $managers[0]; + } + + return 1; } sub _setupGDM { - my $self = shift; - my $attrs = shift; - - my $repoPath = $self->{pluginRepositoryPath}; - mkpath([ - "$repoPath/gdm/workstation", - "$repoPath/gdm/kiosk", - "$repoPath/gdm/chooser", - ]); - - my $pathInfo = $self->{distro}->GDMPathInfo(); - $self->_setupGDMScript($pathInfo); - - my $configHash = $self->{distro}->GDMConfigHashForWorkstation(); - $self->_writeConfigHash($configHash, "$repoPath/gdm/workstation/gdm.conf"); - - $configHash = $self->{distro}->GDMConfigHashForKiosk(); - $self->_writeConfigHash($configHash, "$repoPath/gdm/kiosk/gdm.conf"); - - $configHash = $self->{distro}->GDMConfigHashForChooser(); - $self->_writeConfigHash($configHash, "$repoPath/gdm/chooser/gdm.conf"); - - return; + my $self = shift; + my $attrs = shift; + + my $repoPath = $self->{pluginRepositoryPath}; + mkpath([ + "$repoPath/gdm/workstation", + "$repoPath/gdm/kiosk", + "$repoPath/gdm/chooser", + ]); + + my $pathInfo = $self->{distro}->GDMPathInfo(); + $self->_setupGDMScript($pathInfo); + + my $configHash = $self->{distro}->GDMConfigHashForWorkstation(); + $self->_writeConfigHash($configHash, "$repoPath/gdm/workstation/gdm.conf"); + + $configHash = $self->{distro}->GDMConfigHashForKiosk(); + $self->_writeConfigHash($configHash, "$repoPath/gdm/kiosk/gdm.conf"); + + $configHash = $self->{distro}->GDMConfigHashForChooser(); + $self->_writeConfigHash($configHash, "$repoPath/gdm/chooser/gdm.conf"); + + return; } sub _setupGDMScript { - my $self = shift; - my $pathInfo = shift; - - my $repoPath = $self->{pluginRepositoryPath}; - my $configFile = $pathInfo->{config}; - my $paths - = join( - ' ', - map { '/mnt' . $_ } ( dirname($configFile), @{$pathInfo->{paths}} ) - ); - my $script = unshiftHereDoc(<<" End-of-Here"); - #!/bin/ash - # 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 - spitFile("$repoPath/gdm/desktop.sh", $script); - return; + my $self = shift; + my $pathInfo = shift; + + my $repoPath = $self->{pluginRepositoryPath}; + my $configFile = $pathInfo->{config}; + my $paths + = join( + ' ', + map { '/mnt' . $_ } ( dirname($configFile), @{$pathInfo->{paths}} ) + ); + my $script = unshiftHereDoc(<<" End-of-Here"); + #!/bin/ash + # 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 + spitFile("$repoPath/gdm/desktop.sh", $script); + return; } sub _setupKDM { - my $self = shift; - my $attrs = shift; - + my $self = shift; + my $attrs = shift; + } sub _setupXDM { - my $self = shift; - my $attrs = shift; + my $self = shift; + my $attrs = shift; } sub _writeConfigHash { - my $self = shift; - my $hash = shift || {}; - my $file = shift; - - my $content = ''; - for my $domain (sort keys %$hash) { - $content .= "[$domain]\n"; - for my $key (sort keys %{$hash->{$domain}}) { - my $value - = defined $hash->{$domain}->{$key} - ? $hash->{$domain}->{$key} - : ''; - $content .= "$key=$value\n"; - } - $content .= "\n"; - } - spitFile($file, $content); + my $self = shift; + my $hash = shift || {}; + my $file = shift; + + my $content = ''; + for my $domain (sort keys %$hash) { + $content .= "[$domain]\n"; + for my $key (sort keys %{$hash->{$domain}}) { + my $value + = defined $hash->{$domain}->{$key} + ? $hash->{$domain}->{$key} + : ''; + $content .= "$key=$value\n"; + } + $content .= "\n"; + } + spitFile($file, $content); } 1; diff --git a/os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm b/os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm index 5660d91b..ee1b503b 100644 --- a/os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm +++ b/os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm @@ -9,10 +9,10 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # displaymanager.pm -# - implementation of the 'displaymanager' plugin, which installs +# - implementation of the 'displaymanager' plugin, which installs # all needed information for a displaymanager. Further possibilities: -# change xdmcp to (gdm, kdm, ...) -# change theme for this xdmcp +# change xdmcp to (gdm, kdm, ...) +# change theme for this xdmcp # ----------------------------------------------------------------------------- package OpenSLX::OSPlugin::displaymanager; @@ -26,117 +26,117 @@ use OpenSLX::Utils; sub new { - my $class = shift; + my $class = shift; - my $self = { - name => 'displaymanager', - }; + my $self = { + name => 'displaymanager', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; + my $self = shift; - return { - description => unshiftHereDoc(<<' End-of-Here'), - Sets a displaymanager and creates needed configs, theme can be set as well. - End-of-Here - mustRunAfter => [], - }; + return { + description => unshiftHereDoc(<<' End-of-Here'), + Sets a displaymanager and creates needed configs, theme can be set as well. + End-of-Here + mustRunAfter => [], + }; } sub getAttrInfo { - my $self = shift; + my $self = shift; - return { - 'displaymanager::active' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'displaymanager'-plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - 'displaymanager::precedence' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'displaymanager' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 40, - }, - 'displaymanager::xdmcp' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - which xdmcp to configure, gdm, kdm, xdm?) - End-of-Here - content_regex => qr{^(g|k|x)dm$}, - content_descr => 'allowed: gdm, kdm, xdm', - default => 'xdm', - }, - 'displaymanager::theme' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - name of the theme to apply to the displaymanager (unset for no theme) - End-of-Here - content_regex => undef, - content_descr => undef, - default => 'openslx', - }, - }; + return { + 'displaymanager::active' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'displaymanager'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + 'displaymanager::precedence' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'displaymanager' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 40, + }, + 'displaymanager::xdmcp' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + which xdmcp to configure, gdm, kdm, xdm?) + End-of-Here + content_regex => qr{^(g|k|x)dm$}, + content_descr => 'allowed: gdm, kdm, xdm', + default => 'xdm', + }, + 'displaymanager::theme' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + name of the theme to apply to the displaymanager (unset for no theme) + End-of-Here + content_regex => undef, + content_descr => undef, + default => 'openslx', + }, + }; } sub copyRequiredFilesIntoInitramfs { - my $self = shift; - my $targetPath = shift; - my $attrs = shift; - my $makeInitRamFSEngine = shift; - - my $themeDir = "$openslxConfig{'base-path'}/share/themes"; + my $self = shift; + my $targetPath = shift; + my $attrs = shift; + my $makeInitRamFSEngine = shift; + + my $themeDir = "$openslxConfig{'base-path'}/share/themes"; my $displaymanagerXdmcp = $attrs->{'displaymanager::xdmcp'} || ''; - my $xdmcpConfigDir = "$openslxConfig{'base-path'}/lib/plugins/displaymanager/files/$displaymanagerXdmcp"; - my $displaymanagerTheme = $attrs->{'displaymanager::theme'} || ''; - if ($displaymanagerTheme) { - my $displaymanagerThemeDir - = "$themeDir/$displaymanagerTheme/displaymanager/$displaymanagerXdmcp"; - if (-d $displaymanagerThemeDir) { + my $xdmcpConfigDir = "$openslxConfig{'base-path'}/lib/plugins/displaymanager/files/$displaymanagerXdmcp"; + my $displaymanagerTheme = $attrs->{'displaymanager::theme'} || ''; + if ($displaymanagerTheme) { + my $displaymanagerThemeDir + = "$themeDir/$displaymanagerTheme/displaymanager/$displaymanagerXdmcp"; + if (-d $displaymanagerThemeDir) { $makeInitRamFSEngine->addCMD( "mkdir -p $targetPath/usr/share/files" ); - $makeInitRamFSEngine->addCMD( - "mkdir -p $targetPath/usr/share/themes" - ); - $makeInitRamFSEngine->addCMD( - "cp -a $displaymanagerThemeDir $targetPath/usr/share/themes/" - ); + $makeInitRamFSEngine->addCMD( + "mkdir -p $targetPath/usr/share/themes" + ); + $makeInitRamFSEngine->addCMD( + "cp -a $displaymanagerThemeDir $targetPath/usr/share/themes/" + ); $makeInitRamFSEngine->addCMD( "cp -a $xdmcpConfigDir $targetPath/usr/share/files" ); - } - } - else { - $displaymanagerTheme = '<none>'; - } + } + } + else { + $displaymanagerTheme = '<none>'; + } - vlog( - 1, - _tr( - "displaymanager-plugin: displaymanager=%s", - $displaymanagerTheme - ) - ); + vlog( + 1, + _tr( + "displaymanager-plugin: displaymanager=%s", + $displaymanagerTheme + ) + ); - return; + return; } 1; diff --git a/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm b/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm index 69c5c2c7..dad6756c 100644 --- a/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm +++ b/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # example.pm -# - an example implementation of the OSPlugin API (i.e. an os-plugin) +# - an example implementation of the OSPlugin API (i.e. an os-plugin) # ----------------------------------------------------------------------------- package OpenSLX::OSPlugin::example; @@ -28,127 +28,127 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; + my $class = shift; - my $self = { - name => 'example', - }; + my $self = { + name => 'example', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; - - return { - description => unshiftHereDoc(<<' End-of-Here'), - just an exemplary plugin that prints a smiley when the client boots - End-of-Here - mustRunAfter => [], - }; + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + just an exemplary plugin that prints a smiley when the client boots + End-of-Here + mustRunAfter => [], + }; } sub getAttrInfo -{ # returns a hash-ref with information about all attributes supported - # by this specific plugin - my $self = shift; - - # This default configuration will be added as attributes to the default - # system, such that it can be overruled for any specific system by means - # of slxconfig. - return { - # attribute 'active' is mandatory for all plugins - 'example::active' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'example'-plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - # attribute 'precedence' is mandatory for all plugins - 'example::precedence' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'example' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 50, - }, - - # plugin specific attributes start here ... - 'example::preferred_side' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - determines to which side you have to tilt your head in order - to read the smiley - End-of-Here - content_regex => qr{^(left|right)$}, - content_descr => q{'left' will print ';-)' - 'right' will print '(-;'}, - default => 'left', - }, - }; +{ # returns a hash-ref with information about all attributes supported + # by this specific plugin + my $self = shift; + + # This default configuration will be added as attributes to the default + # system, such that it can be overruled for any specific system by means + # of slxconfig. + return { + # attribute 'active' is mandatory for all plugins + 'example::active' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'example'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + # attribute 'precedence' is mandatory for all plugins + 'example::precedence' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'example' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 50, + }, + + # plugin specific attributes start here ... + 'example::preferred_side' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + determines to which side you have to tilt your head in order + to read the smiley + End-of-Here + content_regex => qr{^(left|right)$}, + content_descr => q{'left' will print ';-)' - 'right' will print '(-;'}, + default => 'left', + }, + }; } sub installationPhase -{ # called while chrooted to the vendor-OS root in order to give the plugin - # a chance to install required files into the vendor-OS. - my $self = shift; - - my $pluginRepositoryPath = shift; - # The folder where the stage1-plugin should store all files - # required by the corresponding stage3 runlevel script. - # As this method is being executed while chrooted into the vendor-OS, - # this path is relative to that root (i.e. directly usable). - my $pluginTempPath = shift; - # A temporary playground that will be cleaned up automatically. - # As this method is being executed while chrooted into the vendor-OS, - # this path is relative to that root (i.e. directly usable). - my $openslxPath = shift; - # the openslx base path bind-mounted into the chroot (/mnt/openslx) - - # for this example plugin, we simply create two files: - spitFile("$pluginRepositoryPath/right", "(-;\n"); - spitFile("$pluginRepositoryPath/left", ";-)\n"); - - # Some plugins have to copy files from their plugin folder into the - # vendor-OS. In order to make this possible while chrooted, the host's - # /opt/openslx folder will be mounted to /mnt/openslx in the vendor-OS. - # So each plugin could copy some files like this: - # - # # get our own name: - # my $pluginName = $self->{'name'}; - # - # # get our own base path: - # my $pluginBasePath = "/mnt/openslx/lib/plugins/$pluginName"; - # - # # copy all needed files now: - # foreach my $file ( qw( file1, file2 ) ) { - # copyFile("$pluginBasePath/$file", "$pluginRepositoryPath/"); - # } - - # name of current os - # $self->{'os-plugin-engine'}->{'vendor-os-name'} - - return; +{ # called while chrooted to the vendor-OS root in order to give the plugin + # a chance to install required files into the vendor-OS. + my $self = shift; + + my $pluginRepositoryPath = shift; + # The folder where the stage1-plugin should store all files + # required by the corresponding stage3 runlevel script. + # As this method is being executed while chrooted into the vendor-OS, + # this path is relative to that root (i.e. directly usable). + my $pluginTempPath = shift; + # A temporary playground that will be cleaned up automatically. + # As this method is being executed while chrooted into the vendor-OS, + # this path is relative to that root (i.e. directly usable). + my $openslxPath = shift; + # the openslx base path bind-mounted into the chroot (/mnt/openslx) + + # for this example plugin, we simply create two files: + spitFile("$pluginRepositoryPath/right", "(-;\n"); + spitFile("$pluginRepositoryPath/left", ";-)\n"); + + # Some plugins have to copy files from their plugin folder into the + # vendor-OS. In order to make this possible while chrooted, the host's + # /opt/openslx folder will be mounted to /mnt/openslx in the vendor-OS. + # So each plugin could copy some files like this: + # + # # get our own name: + # my $pluginName = $self->{'name'}; + # + # # get our own base path: + # my $pluginBasePath = "/mnt/openslx/lib/plugins/$pluginName"; + # + # # copy all needed files now: + # foreach my $file ( qw( file1, file2 ) ) { + # copyFile("$pluginBasePath/$file", "$pluginRepositoryPath/"); + # } + + # name of current os + # $self->{'os-plugin-engine'}->{'vendor-os-name'} + + return; } sub removalPhase -{ # called while chrooted to the vendor-OS root in order to give the plugin - # a chance to uninstall no longer required files from the vendor-OS. - my $self = shift; - my $pluginRepositoryPath = shift; - # the repository folder, relative to the vendor-OS root - my $pluginTempPath = shift; - # the temporary folder, relative to the vendor-OS root - - return; +{ # called while chrooted to the vendor-OS root in order to give the plugin + # a chance to uninstall no longer required files from the vendor-OS. + my $self = shift; + my $pluginRepositoryPath = shift; + # the repository folder, relative to the vendor-OS root + my $pluginTempPath = shift; + # the temporary folder, relative to the vendor-OS root + + return; } 1; diff --git a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm index 11bef626..d4610a4c 100644 --- a/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm +++ b/os-plugins/plugins/theme/OpenSLX/OSPlugin/theme.pm @@ -9,11 +9,11 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # theme.pm -# - implementation of the 'theme' plugin, which applies theming to the +# - implementation of the 'theme' plugin, which applies theming to the # following places: -# + bootsplash (via splashy) -# + displaymanager (gdm, kdm, ...) -# + desktop (to be done) +# + bootsplash (via splashy) +# + displaymanager (gdm, kdm, ...) +# + desktop (to be done) # ----------------------------------------------------------------------------- package OpenSLX::OSPlugin::theme; @@ -27,175 +27,175 @@ use OpenSLX::Utils; sub new { - my $class = shift; + my $class = shift; - my $self = { - name => 'theme', - }; + my $self = { + name => 'theme', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; - - return { - description => unshiftHereDoc(<<' End-of-Here'), - Applies a graphical theme to the bootsplash and the displaymanager. - End-of-Here - mustRunAfter => [], - }; + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + Applies a graphical theme to the bootsplash and the displaymanager. + End-of-Here + mustRunAfter => [], + }; } sub getAttrInfo { - my $self = shift; - - return { - 'theme::active' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'theme'-plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - 'theme::precedence' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'theme' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 30, - }, - - 'theme::splash' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - name of the theme to apply to bootsplash (unset for no theme) - End-of-Here - content_regex => undef, - content_descr => undef, - default => 'openslx', - }, - 'theme::displaymanager' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - name of the theme to apply to displaymanager (unset for no theme) - End-of-Here - content_regex => undef, - content_descr => undef, - default => 'openslx', - }, - 'theme::desktop' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - name of the theme to apply to desktop (unset for no theme) - End-of-Here - content_regex => undef, - content_descr => undef, - default => 'openslx', - }, - }; + my $self = shift; + + return { + 'theme::active' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'theme'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + 'theme::precedence' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'theme' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 30, + }, + + 'theme::splash' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + name of the theme to apply to bootsplash (unset for no theme) + End-of-Here + content_regex => undef, + content_descr => undef, + default => 'openslx', + }, + 'theme::displaymanager' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + name of the theme to apply to displaymanager (unset for no theme) + End-of-Here + content_regex => undef, + content_descr => undef, + default => 'openslx', + }, + 'theme::desktop' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + name of the theme to apply to desktop (unset for no theme) + End-of-Here + content_regex => undef, + content_descr => undef, + default => 'openslx', + }, + }; } sub suggestAdditionalKernelParams { - my $self = shift; - my $makeInitRamFSEngine = shift; - - my @suggestedParams; - - # add vga=0x317 unless explicit vga-mode is already set - if (!$makeInitRamFSEngine->haveKernelParam(qr{\bvga=})) { - push @suggestedParams, 'vga=0x317'; - } - - # add quiet, if not already set - if (!$makeInitRamFSEngine->haveKernelParam('quiet')) { - push @suggestedParams, 'quiet'; - } - - return @suggestedParams; + my $self = shift; + my $makeInitRamFSEngine = shift; + + my @suggestedParams; + + # add vga=0x317 unless explicit vga-mode is already set + if (!$makeInitRamFSEngine->haveKernelParam(qr{\bvga=})) { + push @suggestedParams, 'vga=0x317'; + } + + # add quiet, if not already set + if (!$makeInitRamFSEngine->haveKernelParam('quiet')) { + push @suggestedParams, 'quiet'; + } + + return @suggestedParams; } sub suggestAdditionalKernelModules { - my $self = shift; - my $makeInitRamFSEngine = shift; - - my @suggestedModules; - - # Ubuntu needs vesafb and fbcon (which drags along some others) - if ($makeInitRamFSEngine->{'distro-name'} =~ m{^ubuntu}i) { - push @suggestedModules, qw( vesafb fbcon ) - } - - return @suggestedModules; + my $self = shift; + my $makeInitRamFSEngine = shift; + + my @suggestedModules; + + # Ubuntu needs vesafb and fbcon (which drags along some others) + if ($makeInitRamFSEngine->{'distro-name'} =~ m{^ubuntu}i) { + push @suggestedModules, qw( vesafb fbcon ) + } + + return @suggestedModules; } sub copyRequiredFilesIntoInitramfs { - my $self = shift; - my $targetPath = shift; - my $attrs = shift; - my $makeInitRamFSEngine = shift; - - my $themeDir = "$openslxConfig{'base-path'}/share/themes"; - my $splashTheme = $attrs->{'theme::splash'} || ''; - if ($splashTheme) { - my $splashThemeDir = "$themeDir/$splashTheme/bootsplash"; - if (-d $splashThemeDir) { - my $splashyPath = "$openslxConfig{'base-path'}/share/splashy"; - $makeInitRamFSEngine->addCMD( - "cp -p $splashyPath/* $targetPath/bin/" - ); - $makeInitRamFSEngine->addCMD( - "mkdir -p $targetPath/etc/splashy" - ); - $makeInitRamFSEngine->addCMD( - "cp -a $splashThemeDir/* $targetPath/etc/splashy/" - ); - } - } - else { - $splashTheme = '<none>'; - } - - my $displayManagerTheme = $attrs->{'theme::displaymanager'} || ''; - if ($displayManagerTheme) { - my $displayManagerThemeDir - = "$themeDir/$displayManagerTheme/displaymanager"; - if (-d $displayManagerThemeDir) { - $makeInitRamFSEngine->addCMD( - "mkdir -p $targetPath/usr/share/themes" - ); - $makeInitRamFSEngine->addCMD( - "cp -a $displayManagerThemeDir $targetPath/usr/share/themes/" - ); - } - } - else { - $displayManagerTheme = '<none>'; - } - - vlog( - 1, - _tr( - "theme-plugin: bootsplash=%s displaymanager=%s", - $splashTheme, $displayManagerTheme - ) - ); - - return; + my $self = shift; + my $targetPath = shift; + my $attrs = shift; + my $makeInitRamFSEngine = shift; + + my $themeDir = "$openslxConfig{'base-path'}/share/themes"; + my $splashTheme = $attrs->{'theme::splash'} || ''; + if ($splashTheme) { + my $splashThemeDir = "$themeDir/$splashTheme/bootsplash"; + if (-d $splashThemeDir) { + my $splashyPath = "$openslxConfig{'base-path'}/share/splashy"; + $makeInitRamFSEngine->addCMD( + "cp -p $splashyPath/* $targetPath/bin/" + ); + $makeInitRamFSEngine->addCMD( + "mkdir -p $targetPath/etc/splashy" + ); + $makeInitRamFSEngine->addCMD( + "cp -a $splashThemeDir/* $targetPath/etc/splashy/" + ); + } + } + else { + $splashTheme = '<none>'; + } + + my $displayManagerTheme = $attrs->{'theme::displaymanager'} || ''; + if ($displayManagerTheme) { + my $displayManagerThemeDir + = "$themeDir/$displayManagerTheme/displaymanager"; + if (-d $displayManagerThemeDir) { + $makeInitRamFSEngine->addCMD( + "mkdir -p $targetPath/usr/share/themes" + ); + $makeInitRamFSEngine->addCMD( + "cp -a $displayManagerThemeDir $targetPath/usr/share/themes/" + ); + } + } + else { + $displayManagerTheme = '<none>'; + } + + vlog( + 1, + _tr( + "theme-plugin: bootsplash=%s displaymanager=%s", + $splashTheme, $displayManagerTheme + ) + ); + + return; } 1; diff --git a/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm b/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm index adbc5557..b18aaa02 100644 --- a/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm +++ b/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # vmchooser.pm -# - allows user to pick from a list of virtual machin images +# - allows user to pick from a list of virtual machin images # ----------------------------------------------------------------------------- package OpenSLX::OSPlugin::vmchooser; @@ -23,112 +23,112 @@ use OpenSLX::Utils; sub new { - my $class = shift; + my $class = shift; - my $self = { - name => 'vmchooser', - }; + my $self = { + name => 'vmchooser', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; - - return { - description => unshiftHereDoc(<<' End-of-Here'), - allows user to pick from a list of different virtual machine images - based on xml-files, which tell about available images. - End-of-Here - mustRunAfter => [] - }; + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + allows user to pick from a list of different virtual machine images + based on xml-files, which tell about available images. + End-of-Here + mustRunAfter => [] + }; } sub getAttrInfo { - my $self = shift; - - return { - 'vmchooser::active' => { - applies_to_systems => 0, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'vmchooser'-plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - 'vmchooser::precedence' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'vmchooser' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 50, - }, - }; + my $self = shift; + + return { + 'vmchooser::active' => { + applies_to_systems => 0, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'vmchooser'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + 'vmchooser::precedence' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'vmchooser' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 50, + }, + }; } sub installationPhase -{ # called while chrooted to the vendor-OS root in order to give the plugin - # a chance to install required files into the vendor-OS. - my $self = shift; - - my $pluginRepositoryPath = shift; - # The folder where the stage1-plugin should store all files - # required by the corresponding stage3 runlevel script. - # As this method is being executed while chrooted into the vendor-OS, - # this path is relative to that root (i.e. directly usable). - my $pluginTempPath = shift; - # A temporary playground that will be cleaned up automatically. - # As this method is being executed while chrooted into the vendor-OS, - # this path is relative to that root (i.e. directly usable). - my $openslxPath = shift; - # the openslx base path bind-mounted into the chroot (/mnt/openslx) - - # for this example plugin, we simply create two files: - spitFile("$pluginRepositoryPath/right", "(-;\n"); - spitFile("$pluginRepositoryPath/left", ";-)\n"); - - # Some plugins have to copy files from their plugin folder into the - # vendor-OS. In order to make this possible while chrooted, the host's - # /opt/openslx folder will be mounted to /mnt/openslx in the vendor-OS. - # So each plugin could copy some files like this: - # - - # get our own name: - my $pluginName = $self->{'name'}; - - - # get our own base path: - my $pluginBasePath = "/mnt/openslx/lib/plugins/$pluginName"; - - # copy all needed files now: - foreach my $file ( qw( vmchooser ) ) { - copyFile("$pluginBasePath/$file", "$pluginRepositoryPath/"); - } - - # name of current os - # $self->{'os-plugin-engine'}->{'vendor-os-name'} - - return; +{ # called while chrooted to the vendor-OS root in order to give the plugin + # a chance to install required files into the vendor-OS. + my $self = shift; + + my $pluginRepositoryPath = shift; + # The folder where the stage1-plugin should store all files + # required by the corresponding stage3 runlevel script. + # As this method is being executed while chrooted into the vendor-OS, + # this path is relative to that root (i.e. directly usable). + my $pluginTempPath = shift; + # A temporary playground that will be cleaned up automatically. + # As this method is being executed while chrooted into the vendor-OS, + # this path is relative to that root (i.e. directly usable). + my $openslxPath = shift; + # the openslx base path bind-mounted into the chroot (/mnt/openslx) + + # for this example plugin, we simply create two files: + spitFile("$pluginRepositoryPath/right", "(-;\n"); + spitFile("$pluginRepositoryPath/left", ";-)\n"); + + # Some plugins have to copy files from their plugin folder into the + # vendor-OS. In order to make this possible while chrooted, the host's + # /opt/openslx folder will be mounted to /mnt/openslx in the vendor-OS. + # So each plugin could copy some files like this: + # + + # get our own name: + my $pluginName = $self->{'name'}; + + + # get our own base path: + my $pluginBasePath = "/mnt/openslx/lib/plugins/$pluginName"; + + # copy all needed files now: + foreach my $file ( qw( vmchooser ) ) { + copyFile("$pluginBasePath/$file", "$pluginRepositoryPath/"); + } + + # name of current os + # $self->{'os-plugin-engine'}->{'vendor-os-name'} + + return; } sub removalPhase -{ # called while chrooted to the vendor-OS root in order to give the plugin - # a chance to uninstall no longer required files from the vendor-OS. - my $self = shift; - my $pluginRepositoryPath = shift; - # the repository folder, relative to the vendor-OS root - my $pluginTempPath = shift; - # the temporary folder, relative to the vendor-OS root - - return; +{ # called while chrooted to the vendor-OS root in order to give the plugin + # a chance to uninstall no longer required files from the vendor-OS. + my $self = shift; + my $pluginRepositoryPath = shift; + # the repository folder, relative to the vendor-OS root + my $pluginTempPath = shift; + # the temporary folder, relative to the vendor-OS root + + return; } 1; diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/base.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/base.pm index 7bcdc1f0..2888c007 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/base.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/base.pm @@ -9,7 +9,7 @@ # 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 +# - provides empty base of the OpenSLX OSPlugin Distro API for the vmware # plugin. # ----------------------------------------------------------------------------- package OpenSLX::Distro::base; @@ -17,7 +17,7 @@ package OpenSLX::Distro::base; use strict; use warnings; -our $VERSION = 1.01; # API-version . implementation-version +our $VERSION = 1.01; # API-version . implementation-version use OpenSLX::Basics; use OpenSLX::Utils; @@ -27,15 +27,15 @@ use OpenSLX::Utils; ################################################################################ sub new { - confess "Creating OpenSLX::OSPlugin::Distro::Base-objects directly makes no sense!"; + confess "Creating OpenSLX::OSPlugin::Distro::Base-objects directly makes no sense!"; } sub initialize { - my $self = shift; - my $engine = shift; - - return 1; + my $self = shift; + my $engine = shift; + + return 1; } diff --git a/os-plugins/plugins/vmwarebinary/OpenSLX/OSPlugin/vmwarebinary.pm b/os-plugins/plugins/vmwarebinary/OpenSLX/OSPlugin/vmwarebinary.pm index bf6a9252..5773b1ce 100644 --- a/os-plugins/plugins/vmwarebinary/OpenSLX/OSPlugin/vmwarebinary.pm +++ b/os-plugins/plugins/vmwarebinary/OpenSLX/OSPlugin/vmwarebinary.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # vmwarebinary.pm -# - declares necessary information for the vmware plugin +# - declares necessary information for the vmware plugin # ----------------------------------------------------------------------------- package OpenSLX::OSPlugin::vmwarebinary; @@ -25,106 +25,106 @@ use OpenSLX::Utils; sub new { - my $class = shift; + my $class = shift; - my $self = { - name => 'vmwarebinary', - }; + my $self = { + name => 'vmwarebinary', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; - - return { - description => unshiftHereDoc(<<' End-of-Here'), - !!! descriptive text missing here !!! - End-of-Here - mustRunAfter => [], - }; + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + !!! descriptive text missing here !!! + End-of-Here + mustRunAfter => [], + }; } sub getAttrInfo -{ # returns a hash-ref with information about all attributes supported - # by this specific plugin - my $self = shift; - - # This default configuration will be added as attributes to the default - # system, such that it can be overruled for any specific system by means - # of slxconfig. - return { - # attribute 'active' is mandatory for all plugins - 'vmwarebinary::active' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'vmwarebinary'-plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - # attribute 'precedence' is mandatory for all plugins - 'vmwarebinary::precedence' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'vmwarebinary' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 70, - }, - # attribute 'imagesrc' defines where we can find vmware images - 'vmwarebinary::imagessrc' => { - applies_to_systems => 1, - applies_to_clients => 1, - description => unshiftHereDoc(<<' End-of-Here'), - Where do we store our vmware images? NFS? Filesystem? - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'Allowed values: path or URI', - default => "", - }, - - }; +{ # returns a hash-ref with information about all attributes supported + # by this specific plugin + my $self = shift; + + # This default configuration will be added as attributes to the default + # system, such that it can be overruled for any specific system by means + # of slxconfig. + return { + # attribute 'active' is mandatory for all plugins + 'vmwarebinary::active' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'vmwarebinary'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + # attribute 'precedence' is mandatory for all plugins + 'vmwarebinary::precedence' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'vmwarebinary' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 70, + }, + # attribute 'imagesrc' defines where we can find vmware images + 'vmwarebinary::imagessrc' => { + applies_to_systems => 1, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + Where do we store our vmware images? NFS? Filesystem? + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'Allowed values: path or URI', + default => "", + }, + + }; } sub installationPhase { - my $self = shift; - my $pluginRepositoryPath = shift; - my $pluginTempPath = shift; - my $openslxPath = shift; + my $self = shift; + my $pluginRepositoryPath = shift; + my $pluginTempPath = shift; + my $openslxPath = shift; - # get path of files we need to install - my $pluginFilesPath = "$openslxPath/lib/plugins/$self->{'name'}/files"; + # get path of files we need to install + my $pluginFilesPath = "$openslxPath/lib/plugins/$self->{'name'}/files"; - # copy all needed files now - my @files = qw( installbinary.sh locations - VMware-player-2.0.2-59824.i386.tar.gz depmod.sh uname.sh - nvram.5.0 insmod.sh runvmware-v2 ); - foreach my $file (@files) { - copyFile("$pluginFilesPath/$file", $pluginRepositoryPath); - } + # copy all needed files now + my @files = qw( installbinary.sh locations + VMware-player-2.0.2-59824.i386.tar.gz depmod.sh uname.sh + nvram.5.0 insmod.sh runvmware-v2 ); + foreach my $file (@files) { + copyFile("$pluginFilesPath/$file", $pluginRepositoryPath); + } - system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/installbinary.sh"); + system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/installbinary.sh"); - return; + return; } sub removalPhase { - my $self = shift; - my $pluginRepositoryPath = shift; - my $pluginTempPath = shift; - my $openslxPath = shift; - - rmtree ( [ $pluginRepositoryPath ] ); - - return; + my $self = shift; + my $pluginRepositoryPath = shift; + my $pluginTempPath = shift; + my $openslxPath = shift; + + rmtree ( [ $pluginRepositoryPath ] ); + + return; } 1; diff --git a/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm b/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm index 8accd45d..7d34934f 100644 --- a/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm +++ b/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm @@ -22,214 +22,214 @@ use OpenSLX::Utils; sub new { - my $class = shift; - my $self = { - name => 'x11vnc', - }; + my $class = shift; + my $self = { + name => 'x11vnc', + }; - return bless $self, $class; + return bless $self, $class; } sub getInfo { - my $self = shift; - return { - description => unshiftHereDoc(<<' End-of-Here'), - enables x11vnc server - End-of-Here - mustRunAfter => [], - }; + my $self = shift; + return { + description => unshiftHereDoc(<<' End-of-Here'), + enables x11vnc server + End-of-Here + mustRunAfter => [], + }; } sub getAttrInfo { - my $self = shift; - - return { - 'x11vnc::active' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - should the 'x11vnc' plugin be executed during boot? - End-of-Here - content_regex => qr{^(0|1)$}, - content_descr => '1 means active - 0 means inactive', - default => '1', - }, - - 'x11vnc::precedence' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - the execution precedence of the 'x11vnc' plugin - End-of-Here - content_regex => qr{^\d\d$}, - content_descr => 'allowed range is from 01-99', - default => 50, - }, - - 'x11vnc::mode' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - set x11vnc to listen on X11(default) or console fb - End-of-Here - content_regex => qr{^(x11|fb)$}, - content_descr => 'x11 means listen current X session - fb means listen to tty1 console', - default => 'x11', - }, - - 'x11vnc::scale' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - scale screen size (e.g. as fraction 2/3 or as decimal 0.5) - End-of-Here - content_regex => undef, - content_descr => undef, - default => '', - }, - - 'x11vnc::shared' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - by default x11vnc is always called with the -shared option - End-of-Here - content_regex => qr{^(yes|no|1|0)$}, - content_descr => 'use 1 or yes to enable - 0 or no to disable', - default => 'yes', - }, - - 'x11vnc::force_viewonly' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - disable user interaction with vnc - End-of-Here - content_regex => qr{^(yes|no|1|0)$}, - content_descr => 'use 1 or yes to enable - 0 or no to disable', - default => 'no', - }, - - 'x11vnc::auth_type' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - set authentication type of the vnc connection - End-of-Here - content_regex => qr{^(passwd|rfbauth|none)$}, - content_descr => 'choose: passwd, rfbauth, none', - default => 'passwd', - }, - - 'x11vnc::allowed_hosts' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - set allowed hosts (multiple hosts are seperated by semicolons, (simple) subnets are possible too - e.g. "192.168.") - End-of-Here - content_regex => undef, - content_descr => undef, - default => '', - }, - - 'x11vnc::force_localhost' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - force x11vnc to only accept local connections and only listen on the loopback device - End-of-Here - content_regex => qr{^(1|0|yes|no)$}, - content_descr => 'use 1 or yes to enable - 0 or no to disable', - default => 'no', - }, - - 'x11vnc::pass' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - viewonly password (you can add multiple passwords seperated by semicolons) - (if you're using rfb-auth only the first one is used) - End-of-Here - content_regex => undef, - content_descr => undef, - default => '', - }, - - 'x11vnc::viewonlypass' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - viewonly password (you can add multiple passwords seperated by semicolons) - (disabled with rfb-auth) - End-of-Here - content_regex => undef, - content_descr => undef, - default => 'viewonly', - }, - - 'x11vnc::logging' => { - applies_to_systems => 1, - applies_to_clients => 0, - description => unshiftHereDoc(<<' End-of-Here'), - enable logging - End-of-Here - content_regex => qr{^(1|0|yes|no)$}, - content_descr => 'use 1 or yes to enable - 0 or no to disable', - default => 'yes', - }, - - }; + my $self = shift; + + return { + 'x11vnc::active' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'x11vnc' plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + + 'x11vnc::precedence' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + the execution precedence of the 'x11vnc' plugin + End-of-Here + content_regex => qr{^\d\d$}, + content_descr => 'allowed range is from 01-99', + default => 50, + }, + + 'x11vnc::mode' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + set x11vnc to listen on X11(default) or console fb + End-of-Here + content_regex => qr{^(x11|fb)$}, + content_descr => 'x11 means listen current X session - fb means listen to tty1 console', + default => 'x11', + }, + + 'x11vnc::scale' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + scale screen size (e.g. as fraction 2/3 or as decimal 0.5) + End-of-Here + content_regex => undef, + content_descr => undef, + default => '', + }, + + 'x11vnc::shared' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + by default x11vnc is always called with the -shared option + End-of-Here + content_regex => qr{^(yes|no|1|0)$}, + content_descr => 'use 1 or yes to enable - 0 or no to disable', + default => 'yes', + }, + + 'x11vnc::force_viewonly' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + disable user interaction with vnc + End-of-Here + content_regex => qr{^(yes|no|1|0)$}, + content_descr => 'use 1 or yes to enable - 0 or no to disable', + default => 'no', + }, + + 'x11vnc::auth_type' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + set authentication type of the vnc connection + End-of-Here + content_regex => qr{^(passwd|rfbauth|none)$}, + content_descr => 'choose: passwd, rfbauth, none', + default => 'passwd', + }, + + 'x11vnc::allowed_hosts' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + set allowed hosts (multiple hosts are seperated by semicolons, (simple) subnets are possible too + e.g. "192.168.") + End-of-Here + content_regex => undef, + content_descr => undef, + default => '', + }, + + 'x11vnc::force_localhost' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + force x11vnc to only accept local connections and only listen on the loopback device + End-of-Here + content_regex => qr{^(1|0|yes|no)$}, + content_descr => 'use 1 or yes to enable - 0 or no to disable', + default => 'no', + }, + + 'x11vnc::pass' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + viewonly password (you can add multiple passwords seperated by semicolons) + (if you're using rfb-auth only the first one is used) + End-of-Here + content_regex => undef, + content_descr => undef, + default => '', + }, + + 'x11vnc::viewonlypass' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + viewonly password (you can add multiple passwords seperated by semicolons) + (disabled with rfb-auth) + End-of-Here + content_regex => undef, + content_descr => undef, + default => 'viewonly', + }, + + 'x11vnc::logging' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + enable logging + End-of-Here + content_regex => qr{^(1|0|yes|no)$}, + content_descr => 'use 1 or yes to enable - 0 or no to disable', + default => 'yes', + }, + + }; } sub installationPhase { - my $self = shift; - my $pluginRepositoryPath = shift; - my $pluginTempPath = shift; - my $openslxPath = shift; - - # get path of files we need to install - my $pluginFilesPath = "$openslxPath/lib/plugins/$self->{'name'}/files"; - - # copy all needed files now - copyFile("$pluginFilesPath/x11vnc", "/etc/init.d"); - vlog(3, "install init file"); - - if ( !-x "/usr/bin/x11vnc" ) { - # let's install x11vnc - if ( $self->{'os-plugin-engine'}->{'vendor-os-name'} =~ m/(debian|ubuntu)/i ) { - my $cmd = "aptitude -y install x11vnc"; - vlog(3, "executing: $cmd"); - if (slxsystem($cmd)) { - die _tr( - "unable to execute shell-cmd\n\t%s", $cmd - ); - } - } - if ( $self->{'os-plugin-engine'}->{'vendor-os-name'} =~ m/suse/i ) { - # PLEASE TEST THIS!!! - my $cmd = "zypper -n in x11vnc"; - vlog(3, "executing: $cmd"); - if (slxsystem($cmd)) { - die _tr( - "unable to execute shell-cmd\n\t%s", $cmd - ); - } - } - } else { - vlog(3, "x11vnc is already installed"); - } + my $self = shift; + my $pluginRepositoryPath = shift; + my $pluginTempPath = shift; + my $openslxPath = shift; + + # get path of files we need to install + my $pluginFilesPath = "$openslxPath/lib/plugins/$self->{'name'}/files"; + + # copy all needed files now + copyFile("$pluginFilesPath/x11vnc", "/etc/init.d"); + vlog(3, "install init file"); + + if ( !-x "/usr/bin/x11vnc" ) { + # let's install x11vnc + if ( $self->{'os-plugin-engine'}->{'vendor-os-name'} =~ m/(debian|ubuntu)/i ) { + my $cmd = "aptitude -y install x11vnc"; + vlog(3, "executing: $cmd"); + if (slxsystem($cmd)) { + die _tr( + "unable to execute shell-cmd\n\t%s", $cmd + ); + } + } + if ( $self->{'os-plugin-engine'}->{'vendor-os-name'} =~ m/suse/i ) { + # PLEASE TEST THIS!!! + my $cmd = "zypper -n in x11vnc"; + vlog(3, "executing: $cmd"); + if (slxsystem($cmd)) { + die _tr( + "unable to execute shell-cmd\n\t%s", $cmd + ); + } + } + } else { + vlog(3, "x11vnc is already installed"); + } } sub removalPhase { - my $self = shift; - my $pluginRepositoryPath = shift; - my $pluginTempPath = shift; + my $self = shift; + my $pluginRepositoryPath = shift; + my $pluginTempPath = shift; } 1; |