diff options
-rw-r--r-- | os-plugins/OpenSLX/OSPlugin/Engine.pm | 81 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm (renamed from os-plugins/plugins/desktop/OpenSLX/Distro/base.pm) | 94 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm | 97 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm | 5 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm | 76 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm | 137 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/XX_desktop.sh | 50 |
7 files changed, 282 insertions, 258 deletions
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm index 6211bacd..344bfdb9 100644 --- a/os-plugins/OpenSLX/OSPlugin/Engine.pm +++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm @@ -20,6 +20,7 @@ our $VERSION = 1.01; # API-version . implementation-version use File::Basename; use File::Path; +use Storable; use OpenSLX::Basics; use OpenSLX::OSSetup::Engine; @@ -110,9 +111,9 @@ sub initialize ); } - # merge attributes that were not given on cmdline with the ones that - # already exists in the DB and finally with the default values - $self->{'plugin-attrs'} = $givenAttrs; + # merge attributes that were given on cmdline with the ones that + # already exist in the DB and finally with the default values + $self->{'plugin-attrs'} = { %$givenAttrs }; my $defaultAttrs = $self->{plugin}->getDefaultAttrsForVendorOS( $vendorOSName ); @@ -150,20 +151,47 @@ sub installPlugin my $self = shift; if ($self->{'vendor-os-name'} ne '<<<default>>>') { + + # as the attrs may be changed by the plugin during installation, we + # have to find a way to pass them back to this process (remember; + # installation takes place in a forked process in order to do a chroot). + # We simply serialize the attributes into a temp and deserialize it + # in the calling process. + my $serializedAttrsFile + = "$self->{'plugin-temp-path'}/serialized-attrs"; + my $chrootedSerializedAttrsFile + = "$self->{'chrooted-plugin-temp-path'}/serialized-attrs"; + + mkpath([ $self->{'plugin-repo-path'}, $self->{'plugin-temp-path'} ]); + + # HACK: do a dummy serialization here in order to get Storable + # completely loaded (otherwise it will complain in the chroot about + # missing modules). + store $self->{'plugin-attrs'}, $serializedAttrsFile; + $self->_callChrootedFunctionForPlugin( sub { + # invoke plugin and let it install itself into vendor-OS $self->{plugin}->installationPhase( $self->{'chrooted-plugin-repo-path'}, $self->{'chrooted-plugin-temp-path'}, $self->{'chrooted-openslx-base-path'}, $self->{'plugin-attrs'}, ); + + # serialize possibly changed attributes (executed inside chroot) + store $self->{'plugin-attrs'}, $chrootedSerializedAttrsFile; } ); + + # now retrieve (deserialize) the current attributes and store them + $self->{'plugin-attrs'} = retrieve $serializedAttrsFile; + $self->_addInstalledPluginToDB(); + + # cleanup temp path + rmtree([ $self->{'plugin-temp-path'} ]); } - $self->_addInstalledPluginToDB(); - return 1; } @@ -179,6 +207,9 @@ sub removePlugin my $self = shift; if ($self->{'vendor-os-name'} ne '<<<default>>>') { + + mkpath([ $self->{'plugin-repo-path'}, $self->{'plugin-temp-path'} ]); + $self->_callChrootedFunctionForPlugin( sub { $self->{plugin}->removalPhase( @@ -188,6 +219,8 @@ sub removePlugin ); } ); + + rmtree([ $self->{'plugin-temp-path'} ]); } $self->_removeInstalledPluginFromDB(); @@ -308,8 +341,9 @@ sub downloadFile =item getInstalledPackages() -Returns the list of names of the packages that are already installed in the -vendor-OS. Useful if a plugin wants to find out whether or not it has to +Returns the list of names of the packages (as an array) that are already +installed in the vendor-OS. +Useful if a plugin wants to find out whether or not it has to install additional packages. =cut @@ -324,12 +358,22 @@ sub getInstalledPackages return $metaPackager->getInstalledPackages(); } -sub getPackagesForSelection +=item getInstallablePackagesForSelection() + +Looks at the selection with the given name and returns the list of names of the +packages (as one string separated by spaces) that need to be installed in order +to complete the selection. + +=cut + +sub getInstallablePackagesForSelection { my $self = shift; my $selection = shift; - return $self->{'ossetup-engine'}->getPackagesForSelection($selection); + return $self->{'ossetup-engine'}->getInstallablePackagesForSelection( + $selection + ); } @@ -365,7 +409,7 @@ sub installPackages my $metaPackager = $self->{'ossetup-engine'}->metaPackager(); return if !$metaPackager; - return $metaPackager->installSelection($packages); + return $metaPackager->installPackages($packages); } =item removePackages($packages) @@ -397,7 +441,7 @@ sub removePackages my $metaPackager = $self->{'ossetup-engine'}->metaPackager(); return if !$metaPackager; - return $metaPackager->removeSelection($packages); + return $metaPackager->removePackages($packages); } =back @@ -417,6 +461,7 @@ 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; @@ -425,16 +470,24 @@ sub _loadPlugin $distroName = $1; } push @distroModules, $distroName; - push @distroModules, 'base'; + push @distroModules, 'Base'; for my $distroModule (@distroModules) { -print "trying $distroModule...\n"; last if eval { $distro = instantiateClass( - $distroModule, { pathToClass => $self->{'plugin-path'} } + 'OpenSLX::Distro::' . $distroModule, + { pathToClass => $self->{'plugin-path'} } ); 1; }; } + shift @INC; + if (!$distro) { + die _tr( + 'unable to load any distro module for vendor-OS %s', + $self->{'vendor-os-name'} + ); + } + $distro->initialize($self); } $plugin->initialize($self, $distro); diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/base.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm index b8c7bd8a..37cfff46 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/base.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm @@ -12,7 +12,7 @@ # - provides empty base of the OpenSLX OSPlugin Distro API for the desktop # plugin. # ----------------------------------------------------------------------------- -package OpenSLX::Distro::base; +package OpenSLX::Distro::Base; use strict; use warnings; @@ -27,13 +27,15 @@ use OpenSLX::Utils; ################################################################################ sub new { - confess "Creating OpenSLX::OSPlugin::Distro::Base-objects directly makes no sense!"; + my $class = shift; + my $self = {}; + return bless $self, $class; } sub initialize { - my $self = shift; - my $engine = shift; + my $self = shift; + $self->{engine} = shift; return 1; } @@ -44,36 +46,42 @@ sub isInPath my $binary = shift; my $path = qx{which $binary 2>/dev/null}; - + return $path ? 1 : 0; } -sub isKDEInstalled +sub isGNOMEInstalled { my $self = shift; - - return $self->isInPath('startkde'); + + return $self->isInPath('gnome-session'); } -sub isKDMInstalled +sub isGDMInstalled { my $self = shift; - return $self->isInPath('kdm'); + return $self->isInPath('gdm'); } -sub isGNOMEInstalled +sub installGNOME { my $self = shift; - return $self->isInPath('gnome-session'); + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('gnome') + ); + + return 1; } -sub isGDMInstalled +sub installGDM { my $self = shift; - return $self->isInPath('gdm'); + $self->{engine}->installPackages('gdm'); + + return 1; } sub GDMPathInfo @@ -151,13 +159,45 @@ sub GDMConfigHashForChooser return $configHash; } +sub isKDEInstalled +{ + my $self = shift; + + return $self->isInPath('startkde'); +} + +sub isKDMInstalled +{ + my $self = shift; + + return $self->isInPath('kdm'); +} + +sub installKDE +{ + my $self = shift; + + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('kde') + ); + + return 1; +} + +sub installKDM +{ + my $self = shift; + + $self->{engine}->installPackages('kdm'); + + return 1; +} + sub isXFCEInstalled { my $self = shift; - # TODO: implement this! - warn "someone please implement this!"; - return 0; + return $self->isInPath('startxfce4'); } sub isXDMInstalled @@ -167,4 +207,24 @@ sub isXDMInstalled return $self->isInPath('xdm'); } +sub installXFCE +{ + my $self = shift; + + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('xfce') + ); + + return 1; +} + +sub installXDM +{ + my $self = shift; + + $self->{engine}->installPackages('xdm'); + + return 1; +} + 1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm index a514f10f..c5e6c5cd 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/debian.pm @@ -8,15 +8,16 @@ # # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- -# Debian.pm -# - provides Debian-specific overrides of the OpenSLX OSSetup API. +# debian.pm +# - provides Debian-specific overrides of the OpenSLX Distro API for the +# desktop plugin. # ----------------------------------------------------------------------------- -package OpenSLX::OSSetup::Distro::Debian; +package OpenSLX::Distro::debian; use strict; use warnings; -use base qw(OpenSLX::OSSetup::Distro::Base); +use base qw(OpenSLX::Distro::Base); use OpenSLX::Basics; use OpenSLX::Utils; @@ -24,93 +25,5 @@ use OpenSLX::Utils; ################################################################################ ### 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'} = 'dpkg'; - $self->{'meta-packager-type'} = $ENV{SLX_META_PACKAGER} || 'apt'; - $self->{'stage1c-faked-files'} = []; - return; -} - -sub preSystemInstallationHook -{ - my $self = shift; - - $self->SUPER::preSystemInstallationHook(); - - # fake required /dev-entries - my %devInfo = ( - mem => { type => 'c', major => '1', minor => '1' }, - null => { type => 'c', major => '1', minor => '3' }, - zero => { type => 'c', major => '1', minor => '5' }, - random => { type => 'c', major => '1', minor => '8' }, - urandom => { type => 'c', major => '1', minor => '9' }, - kmsg => { type => 'c', major => '1', minor => '11' }, - console => { type => 'c', major => '5', minor => '1' }, - ptmx => { type => 'c', major => '5', minor => '2' }, - ); - foreach my $dev (keys %devInfo) { - my $info = $devInfo{$dev}; - if (!-e "/dev/$dev") { - if (slxsystem( - "mknod /dev/$dev $info->{type} $info->{major} $info->{minor}" - )) { - croak(_tr("unable to create dev-node '%s'! (%s)", $dev, $!)); - } - } - } - foreach my $devDir ('pts', 'shm', '.udevdb', '.udev') { - if (!-e "/dev/$devDir") { - if (slxsystem("mkdir -p /dev/$devDir")) { - croak(_tr("unable to create dev-dir '%s'! (%s)", $devDir, $!)); - } - } - } - - # replace /usr/sbin/invoke-rc.d by a dummy, in order to avoid a whole lot - # of initscripts being started. Wishful thinking: there should be another - # way to stop Debian from doing this, as this is not really very supportive - # of folder-based installations (then again: I may simply be too stupid - # to find out how it is supposed to work ...) - rename('/usr/sbin/invoke-rc.d', '/usr/sbin/_invoke-rc.d'); - spitFile('/usr/sbin/invoke-rc.d', "#! /bin/sh\nexit 0\n"); - chmod 0755, '/usr/sbin/invoke-rc.d'; -} - -sub postSystemInstallationHook -{ - my $self = shift; - - # restore /usr/sbin/invoke-rc.d - rename('/usr/sbin/_invoke-rc.d', '/usr/sbin/invoke-rc.d'); - $self->SUPER::postSystemInstallationHook(); -} - -sub setPasswordForUser -{ - my $self = shift; - my $username = shift; - my $password = shift; - - # activate shadow passwords - my $activateShadowFunction = sub { - slxsystem('/sbin/shadowconfig', 'on'); - }; - $self->{engine}->callChrootedFunctionForVendorOS($activateShadowFunction); - - # invoke default behaviour - $self->SUPER::setPasswordForUser($username, $password); -} - 1;
\ No newline at end of file diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm index 34363460..761a3705 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/suse.pm @@ -9,14 +9,15 @@ # 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 Distro API for the desktop +# plugin. # ----------------------------------------------------------------------------- package OpenSLX::Distro::suse; use strict; use warnings; -use base qw(OpenSLX::Distro::base); +use base qw(OpenSLX::Distro::Base); use OpenSLX::Basics; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm index 4ab5abbc..9982d363 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/ubuntu.pm @@ -11,12 +11,12 @@ # Ubuntu.pm # - provides Ubuntu-specific overrides of the OpenSLX OSSetup API. # ----------------------------------------------------------------------------- -package OpenSLX::OSSetup::Distro::Ubuntu; +package OpenSLX::Distro::ubuntu; use strict; use warnings; -use base qw(OpenSLX::OSSetup::Distro::Base); +use base qw(OpenSLX::Distro::Base); use OpenSLX::Basics; use OpenSLX::Utils; @@ -24,77 +24,5 @@ use OpenSLX::Utils; ################################################################################ ### 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'} = 'dpkg'; - $self->{'meta-packager-type'} = $ENV{SLX_META_PACKAGER} || 'apt'; - $self->{'stage1c-faked-files'} = []; - return; -} - -sub preSystemInstallationHook -{ - my $self = shift; - - $self->SUPER::preSystemInstallationHook(); - - # fake required /dev-entries - my %devInfo = ( - mem => { type => 'c', major => '1', minor => '1' }, - null => { type => 'c', major => '1', minor => '3' }, - zero => { type => 'c', major => '1', minor => '5' }, - random => { type => 'c', major => '1', minor => '8' }, - urandom => { type => 'c', major => '1', minor => '9' }, - kmsg => { type => 'c', major => '1', minor => '11' }, - console => { type => 'c', major => '5', minor => '1' }, - ptmx => { type => 'c', major => '5', minor => '2' }, - ); - foreach my $dev (keys %devInfo) { - my $info = $devInfo{$dev}; - if (!-e "/dev/$dev") { - if (slxsystem( - "mknod /dev/$dev $info->{type} $info->{major} $info->{minor}" - )) { - croak(_tr("unable to create dev-node '%s'! (%s)", $dev, $!)); - } - } - } - foreach my $devDir ('pts', 'shm', '.udevdb', '.udev') { - if (!-e "/dev/$devDir") { - if (slxsystem("mkdir -p /dev/$devDir")) { - croak(_tr("unable to create dev-dir '%s'! (%s)", $devDir, $!)); - } - } - } - - # replace /usr/sbin/invoke-rc.d by a dummy, in order to avoid a whole lot - # of initscripts being started. Wishful thinking: there should be another - # way to stop Ubuntu from doing this, as this is not really very supportive - # of folder-based installations (then again: I may simply be too stupid - # to find out how it is supposed to work ...) - rename('/usr/sbin/invoke-rc.d', '/usr/sbin/_invoke-rc.d'); - spitFile('/usr/sbin/invoke-rc.d', "#! /bin/sh\nexit 0\n"); - chmod 0755, '/usr/sbin/invoke-rc.d'; -} - -sub postSystemInstallationHook -{ - my $self = shift; - - # restore /usr/sbin/invoke-rc.d - rename('/usr/sbin/_invoke-rc.d', '/usr/sbin/invoke-rc.d'); - $self->SUPER::postSystemInstallationHook(); -} 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 a0dc589c..2f3ffafd 100644 --- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm +++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm @@ -176,15 +176,15 @@ sub getDefaultAttrsForVendorOS my $attrs = $self->getAttrInfo(); - if ($vendorOSName =~ m{kde$}) { + if ($vendorOSName =~ m{kde}) { $attrs->{'desktop::manager'}->{default} = 'kdm'; $attrs->{'desktop::kind'}->{default} = 'kde'; } - elsif ($vendorOSName =~ m{gnome$}) { + elsif ($vendorOSName =~ m{gnome}) { $attrs->{'desktop::manager'}->{default} = 'gdm'; $attrs->{'desktop::kind'}->{default} = 'gnome'; } - elsif ($vendorOSName =~ m{xfce$}) { + elsif ($vendorOSName =~ m{xfce}) { $attrs->{'desktop::manager'}->{default} = 'xdm'; $attrs->{'desktop::kind'}->{default} = 'xcfe'; } @@ -203,18 +203,35 @@ sub installationPhase $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->_determineAttrsByInstalledPackages(); + $self->_fillUnsetStage1Attrs(); + $self->_ensureSensibleStage3Attrs(); use Data::Dumper; print Dumper $self->{attrs}; - if ($self->{attrs}->{'desktop::gdm'}) { + # start to actually do something - according to current stage1 attributes + if ($self->{gdm}) { $self->_setupGDM(); } - if ($self->{attrs}->{'desktop::kdm'}) { + if ($self->{kdm}) { $self->_setupKDM(); } - if ($self->{attrs}->{'desktop::xdm'}) { + if ($self->{xdm}) { $self->_setupXDM(); } @@ -280,42 +297,82 @@ sub _installRequiredPackages my $engine = $self->{'os-plugin-engine'}; - for my $desktop (qw( gnome kde xfce )) { - next if !$self->{attrs}->{"desktop::$desktop"}; - my $packages = $engine->getPackagesForSelection($desktop); - $engine->installPackages($packages); + if ($self->{'gnome'} && !$self->{distro}->isGNOMEInstalled()) { + $self->{distro}->installGNOME(); } - - for my $dm (qw( gdm kdm xdm )) { - next if !$self->{attrs}->{"desktop::$dm"}; - $engine->installPackages($dm); + 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 _determineAttrsByInstalledPackages +sub _fillUnsetStage1Attrs { - my $self = shift; - my $attrs = shift; - - if (!defined $attrs->{'desktop::gnome'}) { - $attrs->{'desktop::gnome'} = $self->{distro}->isGNOMEInstalled(); + my $self = shift; + + if (!defined $self->{'gnome'}) { + $self->{'gnome'} = $self->{distro}->isGNOMEInstalled(); + } + if (!defined $self->{'gdm'}) { + $self->{'gdm'} = $self->{distro}->isGDMInstalled(); } - if (!defined $attrs->{'desktop::gdm'}) { - $attrs->{'desktop::gdm'} = $self->{distro}->isGDMInstalled(); + if (!defined $self->{'kde'}) { + $self->{'kde'} = $self->{distro}->isKDEInstalled(); } - if (!defined $attrs->{'desktop::kde'}) { - $attrs->{'desktop::kde'} = $self->{distro}->isKDEInstalled(); + if (!defined $self->{'kdm'}) { + $self->{'kdm'} = $self->{distro}->isKDMInstalled(); } - if (!defined $attrs->{'desktop::kdm'}) { - $attrs->{'desktop::kdm'} = $self->{distro}->isKDMInstalled(); + if (!defined $self->{'xfce'}) { + $self->{'xfce'} = $self->{distro}->isXFCEInstalled(); } - if (!defined $attrs->{'desktop::xfce'}) { - $attrs->{'desktop::xfde'} = $self->{distro}->isXFCEInstalled(); + if (!defined $self->{'xdm'}) { + $self->{'xdm'} = $self->{distro}->isXDMInstalled(); } - if (!defined $attrs->{'desktop::xdm'}) { - $attrs->{'desktop::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; @@ -327,7 +384,11 @@ sub _setupGDM my $attrs = shift; my $repoPath = $self->{pluginRepositoryPath}; - mkpath([ "$repoPath/gdm" ]); + mkpath([ + "$repoPath/gdm/workstation", + "$repoPath/gdm/kiosk", + "$repoPath/gdm/chooser", + ]); my $pathInfo = $self->{distro}->GDMPathInfo(); $self->_setupGDMScript($pathInfo); @@ -351,12 +412,17 @@ sub _setupGDMScript my $repoPath = $self->{pluginRepositoryPath}; my $configFile = $pathInfo->{config}; - my $paths = join(' ', ( dirname($configFile), @{$pathInfo->{paths}} )); + 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 - ln -sf /mnt$repoPath/gdm/\$desktop_kind/gdm.conf $configFile + 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; @@ -391,6 +457,7 @@ sub _writeConfigHash : ''; $content .= "$key=$value\n"; } + $content .= "\n"; } spitFile($file, $content); } diff --git a/os-plugins/plugins/desktop/XX_desktop.sh b/os-plugins/plugins/desktop/XX_desktop.sh index 0a4a3267..651c4044 100644 --- a/os-plugins/plugins/desktop/XX_desktop.sh +++ b/os-plugins/plugins/desktop/XX_desktop.sh @@ -1,34 +1,36 @@ -#! /bin/sh +#! /bin/ash # -# stage3 part of 'displaymanager' plugin - the runlevel script +# stage3 part of 'desktop' plugin - the runlevel script # . /etc/functions . /etc/distro-functions . /etc/sysconfig/config -if [ -e /initramfs/plugin-conf/displaymanager.conf ]; then - . /initramfs/plugin-conf/displaymanager.conf - if [ $displaymanager_active -ne 0 ]; then - [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'displaymanager' os-plugin ..."; - - testmkd /mnt/var/lib/openslx/themes - testmkd /mnt/var/lib/openslx/config +if [ -e /initramfs/plugin-conf/desktop.conf ]; then + . /initramfs/plugin-conf/desktop.conf + if [ $desktop_active -ne 0 ]; then + [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'desktop' os-plugin ..."; + + testmkd /mnt/var/lib/openslx/themes + testmkd /mnt/var/lib/openslx/config - if [ "${displaymanager_xdmcp}" = "gdm" ]; then - cp /usr/share/config/gdm.conf /mnt/etc/gdm/gdm.conf - cp -a /usr/share/themes/gdm /mnt/var/lib/openslx/themes - sed -i "s,GraphicalThemeDir=.*,GraphicalThemeDir=/var/lib/openslx/themes," \ - /mnt/etc/gdm/gdm.conf - sed -i "s,GraphicalTheme=.*GraphicalTheme=gdm," /mnt/etc/gdm/gdm.conf - fi + . /mnt/opt/openslx/plugin-repo/desktop/${desktop_manager}/desktop.sh - if [ "${displaymanager_xdmcp}" = "kdm" ]; then - cp /usr/share/config/kdmrc /mnt/etc/kde3/kdm/kdmrc - cp -a /usr/share/themes/kdm /mnt/var/lib/openslx/themes - sed -i "s,Theme=.*,Theme=/var/lib/openslx/themes/kdm," /mnt/etc/kde3/kdm/kdmrc - sed -i "s,UseTheme=.*,UseTheme=true," /mnt/etc/kde3/kdm/kdmrc - fi + # TODO: move the following stuff into the gdm-specific desktop.sh + # (and perhaps handle through a template?) + if [ "${desktop_manager}" = "XXXgdm" ]; then + cp -a /usr/share/themes/gdm /mnt/var/lib/openslx/themes + sed -i "s,GraphicalThemeDir=.*,GraphicalThemeDir=/var/lib/openslx/themes," \ + /mnt/etc/gdm/gdm.conf + sed -i "s,GraphicalTheme=.*GraphicalTheme=gdm," /mnt/etc/gdm/gdm.conf + fi - [ $DEBUGLEVEL -gt 0 ] && echo "done with 'displaymanager' os-plugin ..."; + if [ "${desktop_manager}" = "XXXkdm" ]; then + cp -a /usr/share/themes/kdm /mnt/var/lib/openslx/themes + sed -i "s,Theme=.*,Theme=/var/lib/openslx/themes/kdm," /mnt/etc/kde3/kdm/kdmrc + sed -i "s,UseTheme=.*,UseTheme=true," /mnt/etc/kde3/kdm/kdmrc + fi - fi + [ $DEBUGLEVEL -gt 0 ] && echo "done with 'desktop' os-plugin ..."; + + fi fi |