From cacc9fb39bbae560c3a657f049e04ab805058fec Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Tue, 11 Mar 2008 19:45:29 +0000 Subject: added 2. part of theme plugin, has still to be modified. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1618 95ad53e4-c205-0410-b2fa-d234c58c8868 --- .../bootsplash/OpenSLX/OSPlugin/bootsplash.pm | 6 +- os-plugins/plugins/bootsplash/XX_bootsplash.sh | 2 +- .../OpenSLX/OSPlugin/displaymanager.pm | 142 +++++++++++++++++++++ .../plugins/displaymanager/XX_displaymanager.sh | 33 +++++ 4 files changed, 179 insertions(+), 4 deletions(-) create mode 100644 os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm create mode 100644 os-plugins/plugins/displaymanager/XX_displaymanager.sh (limited to 'os-plugins') diff --git a/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm b/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm index 8748dfb2..16345136 100644 --- a/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm +++ b/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm @@ -126,10 +126,10 @@ sub copyRequiredFilesIntoInitramfs my $attrs = shift; my $makeInitRamFSEngine = shift; - my $themesDir = "$openslxConfig{'base-path'}/share/themes"; + my $themeDir = "$openslxConfig{'base-path'}/share/themes"; my $bootsplashTheme = $attrs->{'bootsplash::theme'} || ''; if ($bootsplashTheme) { - my $bootsplashThemeDir = "$themesDir/$bootsplashTheme/bootsplash"; + my $bootsplashThemeDir = "$themeDir/$bootsplashTheme/bootsplash"; if (-d $bootsplashThemeDir) { my $splashyPath = "$openslxConfig{'base-path'}/share/splashy"; $makeInitRamFSEngine->addCMD( @@ -150,7 +150,7 @@ sub copyRequiredFilesIntoInitramfs vlog( 1, _tr( - "bootsplash-plugin: bootsplash=%s + "bootsplash-plugin: bootsplash=%s", $bootsplashTheme ) ); diff --git a/os-plugins/plugins/bootsplash/XX_bootsplash.sh b/os-plugins/plugins/bootsplash/XX_bootsplash.sh index fc65e6f9..4a27dafa 100644 --- a/os-plugins/plugins/bootsplash/XX_bootsplash.sh +++ b/os-plugins/plugins/bootsplash/XX_bootsplash.sh @@ -10,7 +10,7 @@ if [ -e /initramfs/plugin-conf/bootsplash.conf ]; then if [ $bootsplash_active -ne 0 ]; then if [ ${no_bootsplash} -eq 0 ]; then # make the splashy_update binary available in stage4 ... - mkdir -p /mnt/var/lib/openslx/bin + testmkd /mnt/var/lib/openslx/bin cp -a /bin/splashy_update /mnt/var/lib/openslx/bin # ... and create a runlevelscript that will stop splashy somewhere near diff --git a/os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm b/os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm new file mode 100644 index 00000000..44ffd52b --- /dev/null +++ b/os-plugins/plugins/displaymanager/OpenSLX/OSPlugin/displaymanager.pm @@ -0,0 +1,142 @@ +# Copyright (c) 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/ +# ----------------------------------------------------------------------------- +# displaymanager.pm +# - 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 +# ----------------------------------------------------------------------------- +package OpenSLX::OSPlugin::displaymanager; + +use strict; +use warnings; + +use base qw(OpenSLX::OSPlugin::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +sub new +{ + my $class = shift; + + my $self = { + name => 'displaymanager', + }; + + return bless $self, $class; +} + +sub getInfo +{ + 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 => [], + }; +} + +sub getAttrInfo +{ + 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', + }, + }; +} + +sub copyRequiredFilesIntoInitramfs +{ + my $self = shift; + my $targetPath = shift; + my $attrs = shift; + my $makeInitRamFSEngine = shift; + + my $xdmcpConfigDir = "$openslxConfig{'base-path'}/lib/plugins/displaymanager/config/$displaymanagerXdmcp"; + my $themeDir = "$openslxConfig{'base-path'}/share/themes"; + my $displaymanagerXdmcp = $attrs->{'displaymanager::xdmcp'} || ''; + my $displaymanagerTheme = $attrs->{'displaymanager::theme'} || ''; + if ($displaymanagerTheme) { + my $displaymanagerThemeDir + = "$themeDir/$displaymanagerTheme/displaymanager/$displaymanagerXdmcp"; + if (-d $displaymanagerThemeDir) { + $makeInitRamFSEngine->addCMD( + "mkdir -p $targetPath/usr/share/config" + ); + $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/config/" + ); + } + } + else { + $displaymanagerTheme = ''; + } + + vlog( + 1, + _tr( + "displaymanager-plugin: displaymanager=%s", + $displaymanagerTheme + ) + ); + + return; +} + +1; diff --git a/os-plugins/plugins/displaymanager/XX_displaymanager.sh b/os-plugins/plugins/displaymanager/XX_displaymanager.sh new file mode 100644 index 00000000..aa064ebe --- /dev/null +++ b/os-plugins/plugins/displaymanager/XX_displaymanager.sh @@ -0,0 +1,33 @@ +#! /bin/sh +# +# stage3 part of 'displaymanager' 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 [ -d /usr/share/config/gdm ]; then + cp /usr/share/config/gdm.conf /mnt/etc/gdm/gdm.conf + cp -a /usr/share/themes/displaymanager/gdm /mnt/var/lib/openslx/themes + sed -i "s,^\(GraphicalThemeDir=.*\)$,#\1 \nGraphicalThemeDir=/var/lib/openslx/themes," \ + /mnt/etc/gdm/gdm.conf + sed -i "s,^\(GraphicalTheme=.*\)$,#\1 \nGraphicalTheme=gdm," /mnt/etc/gdm/gdm.conf + fi + + if [ -d /usr/share/config/gdm ]; then + cp /usr/share/config/kdmrc /mnt/${D_KDMRCPATH} + cp -a /usr/share/themes/displaymanager/kdm /mnt/var/lib/openslx/themes + sed -i "s,UseTheme=.*,UseTheme=true," /mnt/${D_KDMRCPATH}/kdmrc + fi + + [ $DEBUGLEVEL -gt 0 ] && echo "done with 'displaymanager' os-plugin ..."; + + fi +fi -- cgit v1.2.3-55-g7522