From 2a614b1103699d60e7e2999030d64e2adc9a6955 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 22 May 2008 20:01:34 +0000 Subject: * attributes set via slxconfig are now being checked not only against the respective regex, but the corresponding plugin is being invoked to do a check of its own, too (where it has the chance to look at the vendor-OS attributes and determine the possible stage3-values from their state). * listing a vendor-OS in verbose mode now shows the vendor-OS attributes (stage1 & stage3), too * used Clone::clone instead of Storable::dclone since the latter is not capable of cloning compiled regexes git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1783 95ad53e4-c205-0410-b2fa-d234c58c8868 --- .../plugins/desktop/OpenSLX/OSPlugin/desktop.pm | 112 ++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) (limited to 'os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm') diff --git a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm index 03c26454..92b1e9a9 100644 --- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm +++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm @@ -53,6 +53,7 @@ sub getAttrInfo my $self = shift; return { + # stage3 'desktop::active' => { applies_to_systems => 1, applies_to_clients => 1, @@ -69,7 +70,7 @@ sub getAttrInfo 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_regex => qr{^(gdm|kdm|xdm)$}, content_descr => '"gdm", "kdm" or "xdm"', default => undef, }, @@ -103,6 +104,8 @@ sub getAttrInfo content_descr => 'one of the entries in "supported_themes"', default => 'openslx', }, + + # stage1 'desktop::supported_themes' => { applies_to_vendor_os => 1, description => unshiftHereDoc(<<' End-of-Here'), @@ -197,6 +200,113 @@ sub getDefaultAttrsForVendorOS return $attrs; } +sub checkStage3AttrValues +{ + my $self = shift; + my $stage3Attrs = shift; + my $vendorOSAttrs = shift; + + my $manager = $stage3Attrs->{'desktop::manager'} || ''; + if ($manager eq 'kdm') { + if (!defined $vendorOSAttrs->{'desktop::kdm'}) { + if (!$self->{distro}->isKDMInstalled()) { + die _tr( + "KDM is not installed in vendor-OS, so using it as desktop manager wouldn't work!" + ); + } + } + elsif ($vendorOSAttrs->{'desktop::kdm'} == 0) { + die _tr( + "desktop::kdm is 0, so using KDM as desktop manager is not allowed for this vendor-OS!" + ); + } + } + elsif ($manager eq 'gdm') { + if (!defined $vendorOSAttrs->{'desktop::gdm'}) { + if (!$self->{distro}->isGDMInstalled()) { + die _tr( + "GDM is not installed in vendor-OS, so using it as desktop manager wouldn't work!" + ); + } + } + elsif ($vendorOSAttrs->{'desktop::gdm'} == 0) { + die _tr( + "desktop::gdm is 0, so using GDM as desktop manager is not allowed for this vendor-OS!" + ); + } + } + elsif ($manager eq 'xdm') { + if (!defined $vendorOSAttrs->{'desktop::xdm'}) { + if (!$self->{distro}->isXDMInstalled()) { + die _tr( + "XDM is not installed in vendor-OS, so using it as desktop manager wouldn't work!" + ); + } + } + elsif ($vendorOSAttrs->{'desktop::xdm'} == 0) { + die _tr( + "desktop::xdm is 0, so using XDM as desktop manager is not allowed for this vendor-OS!" + ); + } + } + + my $kind = $stage3Attrs->{'desktop::kind'} || ''; + if ($kind eq 'kde') { + if (!defined $vendorOSAttrs->{'desktop::kde'}) { + if (!$self->{distro}->isKDEInstalled()) { + die _tr( + "KDE is not installed in vendor-OS, so using it as desktop kind wouldn't work!" + ); + } + } + elsif ($vendorOSAttrs->{'desktop::kde'} == 0) { + die _tr( + "desktop::kde is 0, so using KDE as desktop kind is not allowed for this vendor-OS!" + ); + } + } + elsif ($kind eq 'gnome') { + if (!defined $vendorOSAttrs->{'desktop::gnome'}) { + if (!$self->{distro}->isGNOMEInstalled()) { + die _tr( + "GNOME is not installed in vendor-OS, so using it as desktop kind wouldn't work!" + ); + } + } + elsif ($vendorOSAttrs->{'desktop::gnome'} == 0) { + die _tr( + "desktop::gnome is 0, so using GNOME as desktop kind is not allowed for this vendor-OS!" + ); + } + } + elsif ($kind eq 'xfce') { + if (!defined $vendorOSAttrs->{'desktop::xfce'}) { + if (!$self->{distro}->isXFCEInstalled()) { + die _tr( + "XFCE is not installed in vendor-OS, so using it as desktop kind wouldn't work!" + ); + } + } + elsif ($vendorOSAttrs->{'desktop::xfce'} == 0) { + die _tr( + "desktop::xfce is 0, so using XFCE as desktop kind is not allowed for this vendor-OS!" + ); + } + } + + my @supportedThemes + = split ',', $vendorOSAttrs->{'desktop::supported_themes'} || ''; + my $theme = $stage3Attrs->{'desktop::theme'}; + if (defined $theme && !grep { $_ eq $theme } @supportedThemes) { + die _tr( + "'%s' is not a supported theme!\nSupported themes are: %s", + $theme, $vendorOSAttrs->{'desktop::supported_themes'} || '' + ); + } + + return 1; +} + sub installationPhase { my $self = shift; -- cgit v1.2.3-55-g7522