From 4193b0262f4b26c97c8b41b0a375d786d1690995 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 21 Apr 2008 12:51:24 +0000 Subject: * intermediate check-in of recent work at the desktop plugin - GDM handling now seems to work with SUSE and Ubuntu, but proper integration will have to wait until I have shaken off the flu git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1752 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm | 21 +++++++--- .../plugins/desktop/OpenSLX/Distro/Debian.pm | 13 +++++- os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm | 23 ++++++++-- .../plugins/desktop/OpenSLX/Distro/Ubuntu.pm | 24 ++++++++++- .../plugins/desktop/OpenSLX/OSPlugin/desktop.pm | 49 +++++++++++++++++++--- 5 files changed, 112 insertions(+), 18 deletions(-) diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm index dffa1850..80be8bcf 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm @@ -39,12 +39,20 @@ sub initialize return 1; } +sub pathOf +{ + my $self = shift; + my $binary = shift; + + return qx{which $binary 2>/dev/null}; +} + sub isInPath { my $self = shift; my $binary = shift; - my $path = qx{which $binary 2>/dev/null}; + my $path = $self->pathOf($binary); return $path ? 1 : 0; } @@ -98,13 +106,14 @@ sub GDMPathInfo return $pathInfo; } -sub GDMRunlevelLinks +sub patchGDMScript { my $self = shift; + my $script = shift; + + # default implementation does nothing! - return unshiftHereDoc(<<" End-of-Here"); - rllinker gdm 15 15 - End-of-Here + return $script; } sub GDMConfigHashForWorkstation @@ -124,7 +133,7 @@ sub GDMConfigHashForWorkstation Enable => 'false', }, 'greeter' => { - AllowShutdown => 'true', + AllowShutdown => 'false', Browser => 'false', MinimalUID => '500', SecureShutdown => 'false', diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm index 361543e9..d8503973 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm @@ -26,6 +26,17 @@ use OpenSLX::Utils; ### interface methods ################################################################################ -# TODO: implement! +sub patchGDMScript +{ + my $self = shift; + my $script = shift; + + $script .= unshiftHereDoc(<<' End-of-Here'); + rllinker gdm 1 1 + echo '/usr/bin/gdm' > /mnt/etc/X11/default-display-manager + End-of-Here + return $script; +} + 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 2c3818cd..99d8dc70 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm @@ -26,14 +26,29 @@ use OpenSLX::Utils; ### interface methods ################################################################################ -sub GDMRunlevelLinks +sub GDMPathInfo +{ + my $self = shift; + + my $pathInfo = $self->SUPER::GDMPathInfo(); + + # link gdm.conf-custom instead of gdm.conf + $pathInfo->{config} = '/etc/X11/gdm/gdm.conf-custom'; + + return $pathInfo; +} + +sub patchGDMScript { my $self = shift; + my $script = shift; - return unshiftHereDoc(<<" End-of-Here"); - rllinker earlygdm 1 15 - rllinker xdm 15 1 + $script .= unshiftHereDoc(<<' End-of-Here'); + rllinker xdm 1 1 + sed -i 's/DISPLAYMANAGER=.*/DISPLAYMANAGER="gdm"/' \ + /mnt/etc/sysconfig/displaymanager End-of-Here + return $script; } 1; diff --git a/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm index 7cd8ebc7..bcbfe768 100644 --- a/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm +++ b/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm @@ -26,6 +26,28 @@ use OpenSLX::Utils; ### interface methods ################################################################################ -# TODO: implement! +sub GDMPathInfo +{ + my $self = shift; + + my $pathInfo = $self->SUPER::GDMPathInfo(); + + # link gdm.conf-custom instead of gdm.conf + $pathInfo->{config} = '/etc/gdm/gdm.conf-custom'; + + return $pathInfo; +} + +sub patchGDMScript +{ + my $self = shift; + my $script = shift; + + $script .= unshiftHereDoc(<<' End-of-Here'); + rllinker gdm 1 1 + echo '/usr/sbin/gdm' > /mnt/etc/X11/default-display-manager + End-of-Here + return $script; +} 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 70f8d71c..a3ce54ee 100644 --- a/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm +++ b/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm @@ -230,6 +230,7 @@ sub installationPhase if ($self->{xdm}) { $self->_setupXDM(); } + $self->_setupSupportedThemes(); return; } @@ -379,7 +380,6 @@ sub _ensureSensibleStage3Attrs sub _setupGDM { my $self = shift; - my $attrs = shift; my $repoPath = $self->{pluginRepositoryPath}; mkpath([ @@ -418,10 +418,26 @@ sub _setupGDMScript 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 + + mkdir -p \$(dirname /mnt$configFile) 2>/dev/null + cp /mnt/$repoPath/gdm/\$desktop_mode/gdm.conf /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 + theme=\$desktop_theme + if [ -e /mnt\$thdir/\$desktop_theme/gdm/\${theme}.xml ]; then + sed -i "s,\\[greeter\\],[greeter]\\nGraphicalThemeDir=\$thdir," \\ + /mnt/$configFile + sed -i "s,\\[greeter\\],[greeter]\\nGraphicalTheme=\$theme," \\ + /mnt/$configFile + fi + fi End-of-Here - $script .= $self->{distro}->GDMRunlevelLinks(); + $script = $self->{distro}->patchGDMScript($script); spitFile("$repoPath/gdm/desktop.sh", $script); return; } @@ -429,14 +445,11 @@ sub _setupGDMScript sub _setupKDM { my $self = shift; - my $attrs = shift; - } sub _setupXDM { my $self = shift; - my $attrs = shift; } sub _writeConfigHash @@ -460,4 +473,28 @@ sub _writeConfigHash spitFile($file, $content); } +sub _setupSupportedThemes +{ + my $self = shift; + + my $supportedThemes = $self->{attrs}->{'desktop::supported_themes'} || ''; + my @supportedThemes = split m{\s*,\s*}, $supportedThemes; + return if !@supportedThemes; + + my $themeBaseDir = "$self->{openslxPath}/share/themes"; + THEME: + for my $theme (@supportedThemes) { + my $themeDir = "$themeBaseDir/$theme/displaymanager"; + if (!-e $themeDir) { + warn _tr('theme "%s" not found - skipped!', $theme); + next; + } + my $themeTargetPath = "$self->{pluginRepositoryPath}/themes/"; + mkpath($themeTargetPath); + vlog(1, "installing theme '$theme'..."); + slxsystem("cp -a $themeDir $themeTargetPath/$theme") == 0 + or die _tr('unable to copy theme %s (%s)', $theme, $!); + } +} + 1; -- cgit v1.2.3-55-g7522