diff options
author | Oliver Tappe | 2008-05-20 15:24:28 +0200 |
---|---|---|
committer | Oliver Tappe | 2008-05-20 15:24:28 +0200 |
commit | 4107122aea9c2aed804d46f4e3e726e5da051244 (patch) | |
tree | 515238d81d7274b14e54838e1c1aaccf01be0fa8 /os-plugins/plugins/desktop/OpenSLX | |
parent | * optimized the methods that set the attributes of a client/group/system to (diff) | |
download | core-4107122aea9c2aed804d46f4e3e726e5da051244.tar.gz core-4107122aea9c2aed804d46f4e3e726e5da051244.tar.xz core-4107122aea9c2aed804d46f4e3e726e5da051244.zip |
* more work at desktop plugin (GDM & KDM should now work on SUSE & Ubuntu)
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1777 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/desktop/OpenSLX')
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm | 155 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm | 31 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm | 41 | ||||
-rw-r--r-- | os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm | 45 |
4 files changed, 249 insertions, 23 deletions
diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm index b9bf5f03..2777dc13 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm @@ -59,18 +59,31 @@ sub isInPath return $path ? 1 : 0; } -sub isGNOMEInstalled +sub getDefaultDesktopManager { my $self = shift; + + # the default implementation prefers GDM over KDM over XDM + return $self->isGDMInstalled() ? 'gdm' + : $self->isKDMInstalled() ? 'kdm' + : $self->isXDMInstalled() ? 'xdm' : undef; +} - return $self->isInPath('gnome-session'); +sub getDefaultDesktopKind +{ + my $self = shift; + + # the default implementation prefers GNOME over KDE over XFCE + return $self->isGNOMEInstalled() ? 'gnome' + : $self->isKDEInstalled() ? 'kde' + : $self->isXFCEInstalled() ? 'xfce' : undef; } -sub isGDMInstalled +sub isGNOMEInstalled { my $self = shift; - return $self->isInPath('gdm'); + return $self->isInPath('gnome-session'); } sub installGNOME @@ -84,6 +97,13 @@ sub installGNOME return 1; } +sub isGDMInstalled +{ + my $self = shift; + + return $self->isInPath('gdm'); +} + sub installGDM { my $self = shift; @@ -132,7 +152,7 @@ sub setupGDMScript # activate theme only if the corresponding xml file is found # (otherwise fall back to default theme of vendor-OS) if [ -n "\$desktop_theme" ]; then - thdir=/opt/openslx/plugin-repo/desktop/themes/openslx/gdm + thdir=/opt/openslx/plugin-repo/desktop/themes/\$desktop_theme/gdm theme=\$desktop_theme if [ -e /mnt\$thdir/\$theme/\$theme.xml ]; then sed -i "s,\\[greeter\\],[greeter]\\nGraphicalThemeDir=\$thdir," \\ @@ -189,7 +209,6 @@ sub GDMConfigHashForKiosk my $self = shift; my $configHash = $self->GDMConfigHashForWorkstation(); - $configHash->{daemon}->{AutomaticLoginEnable} = 'true'; $configHash->{daemon}->{AutomaticLogin} = 'nobody'; @@ -213,13 +232,6 @@ sub isKDEInstalled return $self->isInPath('startkde'); } -sub isKDMInstalled -{ - my $self = shift; - - return $self->isInPath('kdm'); -} - sub installKDE { my $self = shift; @@ -231,6 +243,13 @@ sub installKDE return 1; } +sub isKDMInstalled +{ + my $self = shift; + + return $self->isInPath('kdm'); +} + sub installKDM { my $self = shift; @@ -240,18 +259,113 @@ sub installKDM return 1; } -sub isXFCEInstalled +sub KDMPathInfo { my $self = shift; + + my $pathInfo = { + config => '/etc/opt/kdm/kdmrc', + paths => [ + '/var/adm/kdm', + '/var/lib/kdm', + ], + }; - return $self->isInPath('startxfce4'); + return $pathInfo; } -sub isXDMInstalled +sub setupKDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $pathInfo = $self->KDMPathInfo(); + 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 + + cp /mnt/$repoPath/kdm/\$desktop_mode/kdmrc /mnt$configFile + + # activate theme only if the corresponding xml file is found + # (otherwise fall back to default theme of vendor-OS) + if [ -n "\$desktop_theme" ]; then + thdir=/opt/openslx/plugin-repo/desktop/themes/\$desktop_theme/kdm + theme=\$desktop_theme + if [ -e /mnt\$thdir/\$theme.xml ]; then + sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nTheme=\$thdir," \\ + /mnt$configFile + sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nUseTheme=true," \\ + /mnt$configFile + fi + fi + End-of-Here + + return $script; +} + +sub KDMConfigHashForWorkstation +{ + my $self = shift; + + return { + 'X-:0-Core' => { + AutoLoginEnable => 'false', + }, + 'X-*-Greeter' => { + GreetString => 'OpenSLX (%h)', + SelectedUsers => '', + ShowUsers => 'Selected', + UserList => 'false', + }, + 'X-:*-Greeter' => { + AllowClose => 'false', + UseAdminSession => 'true', + }, + 'X-:0-Greeter' => { + LogSource => '/dev/xconsole', + UseAdminSession => 'false', + }, + 'xdmcp' => { + Enable => 'false', + }, + }; +} + +sub KDMConfigHashForKiosk { my $self = shift; + + my $configHash = $self->KDMConfigHashForWorkstation(); + $configHash->{daemon}->{AutoLoginEnable} = 'true'; + $configHash->{daemon}->{AutoLoginUser} = 'nobody'; - return $self->isInPath('xdm'); + return $configHash; +} + +sub KDMConfigHashForChooser +{ + my $self = shift; + + my $configHash = $self->KDMConfigHashForWorkstation(); + $configHash->{xdmcp}->{Enable} = 'true'; + + return $configHash; +} + +sub isXFCEInstalled +{ + my $self = shift; + + return $self->isInPath('startxfce4'); } sub installXFCE @@ -265,6 +379,13 @@ sub installXFCE return 1; } +sub isXDMInstalled +{ + my $self = shift; + + return $self->isInPath('xdm'); +} + sub installXDM { my $self = shift; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm index cbfbf83f..08633fcd 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm @@ -19,6 +19,8 @@ use warnings; use base qw(desktop::OpenSLX::Distro::Base); +use File::Path; + use OpenSLX::Basics; use OpenSLX::Utils; @@ -32,7 +34,7 @@ sub GDMPathInfo my $pathInfo = $self->SUPER::GDMPathInfo(); - # link gdm.conf-custom instead of gdm.conf + # create gdm.conf-custom instead of gdm.conf $pathInfo->{config} = '/etc/X11/gdm/gdm.conf-custom'; return $pathInfo; @@ -49,6 +51,33 @@ sub setupGDMScript rllinker xdm 1 1 sed -i 's/DISPLAYMANAGER=.*/DISPLAYMANAGER="gdm"/' \ /mnt/etc/sysconfig/displaymanager + sed -i "s/DEFAULT_WM=.*/DEFAULT_WM=\"$desktop_kind\"/" \ + /mnt/etc/sysconfig/windowmanager + End-of-Here + + return $script; +} + +sub setupKDMScript +{ + my $self = shift; + my $repoPath = shift; + + # SUSE reads /var/adm/kdm/kdmrc.sysconfig, so we link that to + # our config file + my $pathInfo = $self->GDMPathInfo(); + my $configFile = $pathInfo->{config}; + mkpath("/etc/opt/kdm"); + system("ln -sfn /etc/opt/kdm/kdmrc /var/adm/kdm/kdmrc.sysconfig"); + + my $script = $self->SUPER::setupKDMScript($repoPath); + + $script .= unshiftHereDoc(<<' End-of-Here'); + rllinker xdm 1 1 + sed -i 's/DISPLAYMANAGER=.*/DISPLAYMANAGER="kdm"/' \ + /mnt/etc/sysconfig/displaymanager + sed -i "s/DEFAULT_WM=.*/DEFAULT_WM=\"$desktop_kind\"/" \ + /mnt/etc/sysconfig/windowmanager End-of-Here return $script; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm new file mode 100644 index 00000000..a41a84d1 --- /dev/null +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm @@ -0,0 +1,41 @@ +# Copyright (c) 2006, 2007 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# desktop/OpenSLX/Distro/Suse_10_2.pm +# - provides SUSE-10.2-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Suse_10_2; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Suse); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +sub GDMPathInfo +{ + my $self = shift; + + my $pathInfo = $self->SUPER::GDMPathInfo(); + + # link gdm.conf-custom instead of gdm.conf + $pathInfo->{config} = '/etc/opt/gnome/gdm/custom.conf'; + + return $pathInfo; +} + +1; diff --git a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm index 610e0583..03c26454 100644 --- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm +++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm @@ -70,7 +70,7 @@ sub getAttrInfo 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', + content_descr => '"gdm", "kdm" or "xdm"', default => undef, }, 'desktop::kind' => { @@ -79,8 +79,8 @@ sub getAttrInfo 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', + content_regex => qr{^(gnome|kde|xfce)$}, + content_descr => '"gnome", "kde" or "xfce"', default => undef, }, 'desktop::mode' => { @@ -91,7 +91,7 @@ sub getAttrInfo workstattion, kiosk or chooser? End-of-Here content_regex => qr{^(workstation|kiosk|chooser)$}, - content_descr => 'allowed: workstation,kiosk,chooser', + content_descr => '"workstation", "kiosk" or "chooser"', default => 'workstation', }, 'desktop::theme' => { @@ -189,7 +189,10 @@ sub getDefaultAttrsForVendorOS $attrs->{'desktop::kind'}->{default} = 'xcfe'; } else { - # TODO: chroot into vendor-OS and determine the available desktop + $attrs->{'desktop::manager'}->{default} + = $self->{distro}->getDefaultDesktopManager(); + $attrs->{'desktop::kind'}->{default} + = $self->{distro}->getDefaultDesktopKind(); } return $attrs; } @@ -418,6 +421,38 @@ sub _setupGDMScript sub _setupKDM { my $self = shift; + + my $repoPath = $self->{pluginRepositoryPath}; + mkpath([ + "$repoPath/kdm/workstation", + "$repoPath/kdm/kiosk", + "$repoPath/kdm/chooser", + ]); + + $self->_setupKDMScript(); + + my $configHash = $self->{distro}->KDMConfigHashForWorkstation(); + $self->_writeConfigHash($configHash, "$repoPath/kdm/workstation/kdmrc"); + + $configHash = $self->{distro}->KDMConfigHashForKiosk(); + $self->_writeConfigHash($configHash, "$repoPath/kdm/kiosk/kdmrc"); + + $configHash = $self->{distro}->KDMConfigHashForChooser(); + $self->_writeConfigHash($configHash, "$repoPath/kdm/chooser/kdmrc"); + + return; +} + +sub _setupKDMScript +{ + my $self = shift; + + my $repoPath = $self->{pluginRepositoryPath}; + my $script = $self->{distro}->setupKDMScript($repoPath); + + spitFile("$repoPath/kdm/desktop.sh", $script); + + return; } sub _setupXDM |