diff options
Diffstat (limited to 'src/os-plugins/plugins/desktop/OpenSLX/Distro')
10 files changed, 1394 insertions, 0 deletions
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm new file mode 100644 index 00000000..316448bb --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm @@ -0,0 +1,432 @@ +# Copyright (c) 2008 - 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/Base.pm +# - provides base implementation of the Distro API for the desktop plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Base; + +use strict; +use warnings; + +our $VERSION = 1.01; # API-version . implementation-version + +use File::Basename; +use Scalar::Util qw( weaken ); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ +sub new +{ + my $class = shift; + my $self = {}; + return bless $self, $class; +} + +sub initialize +{ + my $self = shift; + $self->{engine} = shift; + weaken($self->{'engine'}); + # avoid circular reference between distro and its engine + + return 1; +} + +sub getDefaultDesktopManager +{ + my $self = shift; + + # the default implementation prefers KDM over GDM over XDM + return $self->isKDMInstalled() ? 'kdm' + : $self->isGDMInstalled() ? 'gdm' + : $self->isXDMInstalled() ? 'xdm' : undef; +} + +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 isGNOMEInstalled +{ + my $self = shift; + + return isInPath('gnome-session'); +} + +sub installGNOME +{ + my $self = shift; + + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('gnome') + ); + + return 1; +} + +sub isGDMInstalled +{ + my $self = shift; + + return isInPath('gdm'); +} + +sub installGDM +{ + my $self = shift; + + $self->{engine}->installPackages('gdm'); + + return 1; +} + +sub GDMPathInfo +{ + my $self = shift; + + my $pathInfo = { + config => '/etc/gdm/gdm.conf', + paths => [ + '/var/lib/gdm', + '/var/log/gdm', + ], + }; + + return $pathInfo; +} + +sub setupGDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $pathInfo = $self->GDMPathInfo(); + my $configFile = $pathInfo->{config}; + + my $paths + = join( + ' ', + map { '/mnt' . $_ } ( dirname($configFile), @{$pathInfo->{paths}} ) + ); + my $script = unshiftHereDoc(<<" End-of-Here"); + # written by OpenSLX-plugin 'desktop' + + for i in $paths; do + testmkd \$i + done + + 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/gdm + theme=\$desktop_theme + if [ -e /mnt\$thdir/\$theme/*.xml ]; then + sed -i "s,\\[greeter\\],[greeter]\\nGraphicalThemedColor=," \\ + /mnt$configFile + sed -i "s,\\[greeter\\],[greeter]\\nGraphicalThemeDir=\$thdir," \\ + /mnt$configFile + sed -i "s,\\[greeter\\],[greeter]\\nGraphicalTheme=\$theme," \\ + /mnt$configFile + fi + fi + case "\${desktop_allowshutdown}" in + none) + ;; + root) + sed "s|AllowShutdown.*|AllowShutdown=true|;\\ + s|SecureShutdown.*|SecureShutdown=true|" \\ + -i /mnt$configFile + ;; + users) + sed "s|AllowShutdown.*|AllowShutdown=true|;\\ + s|SecureShutdown.*|SecureShutdown=false|" \\ + -i /mnt$configFile + ;; + esac + [ "\${desktop_rootlogin}" -ne 0 ] && \\ + sed "s|AllowRoot.*|AllowRoot=true|" -i /mnt$configFile + End-of-Here + + return $script; +} + +sub GDMConfigHashForWorkstation +{ + my $self = shift; + + return { + 'chooser' => { + }, + 'daemon' => { + AutomaticLoginEnable => 'false', + Group => 'gdm', + User => 'gdm', + DefaultSession => 'default.desktop', + }, + 'debug' => { + Enable => 'false', + }, + 'greeter' => { + AllowShutdown => 'false', + Browser => 'false', + MinimalUID => '500', + SecureShutdown => 'false', + ShowDomain => 'false', + DefaultWelcome => 'false', + Welcome => 'OpenSLX Workstation (%n)', + }, + 'gui' => { + }, + 'security' => { + AllowRoot => 'false', + AllowRemoteRoot => 'false', + DisallowTCP => 'true', + SupportAutomount => 'true', + }, + 'server' => { + }, + 'xdmcp' => { + Enable => 'false', + }, + }; +} + +sub GDMConfigHashForKiosk +{ + my $self = shift; + + my $configHash = $self->GDMConfigHashForWorkstation(); + $configHash->{daemon}->{AutomaticLoginEnable} = 'true'; + $configHash->{daemon}->{AutomaticLogin} = 'nobody'; + + return $configHash; +} + +sub GDMConfigHashForChooser +{ + my $self = shift; + + my $configHash = $self->GDMConfigHashForWorkstation(); + $configHash->{xdmcp}->{Enable} = 'true'; + + return $configHash; +} + +sub isKDEInstalled +{ + my $self = shift; + + return isInPath('startkde'); +} + +sub installKDE +{ + my $self = shift; + + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('kde') + ); + + return 1; +} + +sub isKDMInstalled +{ + my $self = shift; + + return isInPath('kdm'); +} + +sub installKDM +{ + my $self = shift; + + $self->{engine}->installPackages('kdm'); + + return 1; +} + +sub KDMPathInfo +{ + my $self = shift; + + my $pathInfo = { + config => '/etc/opt/kdm/kdmrc', + paths => [ + '/var/lib/kdm', + ], + }; + + return $pathInfo; +} + +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/sh + # written by OpenSLX-plugin 'desktop' + + for i in $paths; do + testmkd \$i + done + + 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 + theme=\$desktop_theme + thdir=/opt/openslx/plugin-repo/desktop/themes/kdm/\$theme + if [ -e /mnt\$thdir/*.xml ]; then + sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nUseBackground=false," \\ + /mnt$configFile + sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nTheme=\$thdir," \\ + /mnt$configFile + sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nUseTheme=true," \\ + /mnt$configFile + fi + fi + case "\${desktop_allowshutdown}" in + none) + sed "s|AllowShutdown.*|AllowShutdown=None|" \\ + -i /mnt$configFile + ;; + root) + sed "s|AllowShutdown.*|AllowShutdown=Root|" \\ + -i /mnt$configFile + ;; + users) + sed "s|AllowShutdown.*|AllowShutdown=All|" \\ + -i /mnt$configFile + ;; + esac + [ "\${desktop_rootlogin}" -ne 0 ] && \\ + sed "s|AllowRootLogin.*|AllowRootLogin=true|" -i /mnt$configFile + End-of-Here + + return $script; +} + +sub KDMConfigHashForWorkstation +{ + my $self = shift; + + return { +# 'General' => { +# StaticServers => ':0', +# ReserveServers => ':1,:2,:3', +# ServerVTs => '-7', +# ConsoleTTYs => 'tty1,tty2,tty3,tty4,tty5,tty6', +# }, + 'X-:0-Core' => { + AutoLoginEnable => 'false', + AllowRootLogin => 'false', + AllowShutdown => 'All', + }, + 'X-*-Greeter' => { + GreetString => 'OpenSLX Workstation (%h)', + SelectedUsers => '', + UserList => 'false', + }, + 'X-:*-Greeter' => { + AllowClose => 'false', + UseAdminSession => 'true', + }, + 'X-:0-Greeter' => { + LogSource => '/dev/xconsole', + UseAdminSession => 'false', + PreselectUser => 'None', + }, + 'xdmcp' => { + Enable => 'false', + }, + }; +} + +sub KDMConfigHashForKiosk +{ + my $self = shift; + + my $configHash = $self->KDMConfigHashForWorkstation(); + $configHash->{'X-:0-Core'}->{AutoLoginEnable} = 'true'; + $configHash->{'X-:0-Core'}->{AutoLoginUser} = 'nobody'; + + return $configHash; +} + +sub KDMConfigHashForChooser +{ + my $self = shift; + + my $configHash = $self->KDMConfigHashForWorkstation(); + $configHash->{xdmcp}->{Enable} = 'true'; + + return $configHash; +} + +sub isXFCEInstalled +{ + my $self = shift; + + return isInPath('startxfce4'); +} + +sub installXFCE +{ + my $self = shift; + + $self->{engine}->installPackages( + $self->{engine}->getInstallablePackagesForSelection('xfce') + ); + + return 1; +} + +sub isXDMInstalled +{ + my $self = shift; + + return isInPath('xdm'); +} + +sub installXDM +{ + my $self = shift; + + $self->{engine}->installPackages('xdm'); + + return 1; +} + +1; diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm new file mode 100644 index 00000000..c212b3ef --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm @@ -0,0 +1,63 @@ +# Copyright (c) 2006..2009 - 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/Debian.pm +# - provides Debian-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Debian; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +sub setupGDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $script = $self->SUPER::setupGDMScript($repoPath); + + $script .= unshiftHereDoc(<<' End-of-Here'); + rllinker gdm 1 1 + echo '/usr/bin/gdm' > /mnt/etc/X11/default-display-manager + # gdm does not like AUFS/UnionFS on its var directory + rm -rf /mnt/var/lib/gdm + mkdir -m 1770 /mnt/var/lib/gdm + chown root:gdm /mnt/var/lib/gdm + End-of-Here + + return $script; +} + +sub setupKDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $script = $self->SUPER::setupKDMScript($repoPath); + + $script .= unshiftHereDoc(<<' End-of-Here'); + rllinker kdm 1 1 + echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager + End-of-Here + + return $script; +} + +1; diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm new file mode 100644 index 00000000..f9428aab --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm @@ -0,0 +1,30 @@ +# 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/Fedora.pm +# - provides Fedora-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Fedora; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ + +# TODO: implement! + +1;
\ No newline at end of file diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm new file mode 100644 index 00000000..129f4d08 --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm @@ -0,0 +1,30 @@ +# 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/Gentoo.pm +# - provides Gentoo-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Gentoo; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ + +# TODO: implement! + +1; diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm new file mode 100644 index 00000000..1dc0482c --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm @@ -0,0 +1,132 @@ +# Copyright (c) 2006..2009 - 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/Scilin.pm
+# - provides Scilin-specific overrides of the Distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Scilin;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # create gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/custom.conf';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ # include common stuff (independent of display manager used)
+ $script = _setupCommonDmScript($script);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ echo "DISPLAYMANAGER=GNOME" \
+ >/mnt/etc/sysconfig/desktop
+ # gdm does not like AUFS/UnionFS on its var directory
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ End-of-Here
+
+ return $script;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions';
+ $configHash->{'daemon'}->{Greeter} =
+ '/usr/libexec/gdmgreeter';
+
+ return $configHash;
+}
+
+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->KDMPathInfo();
+ my $configFile = $pathInfo->{config};
+ mkpath("/etc/opt/kdm");
+ mkpath("/var/adm/kdm");
+ # maybe backup kdmrc.sysconfig sometimes
+ unlink("/var/adm/kdm/kdmrc.sysconfig");
+ # the config file gets overwritten if this script is present
+ unlink("/opt/kde3/share/apps/kdm/read_sysconfig.sh");
+ symlink("/etc/opt/kdm/kdmrc", "/var/adm/kdm/kdmrc.sysconfig");
+
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ # include common stuff (independent of display manager used)
+ $script = _setupCommonDmScript($script);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ echo "DISPLAYMANAGER=KDE" \
+ >/mnt/etc/sysconfig/desktop
+ End-of-Here
+
+ return $script;
+}
+
+sub _setupCommonDmScript
+{
+ my $script = shift;
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/X11/xdm/Xreset \
+ > /mnt/etc/X11/xdm/Xreset.system
+ echo -e '#!/bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
+ . /etc/X11/xdm/Xreset.system' >/mnt/etc/X11/xdm/Xreset
+ chmod a+x /mnt/etc/X11/xdm/Xreset*
+
+ # enable the inittab entry again (incomplete)
+ # sed -e "s,# line deleted.*,x:5:respawn:/etc/X11/prefdm -nodaemon," \
+ # -i /mnt/etc/inittab
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm new file mode 100644 index 00000000..433ed7e1 --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm @@ -0,0 +1,162 @@ +# Copyright (c) 2006..2010 - 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.pm +# - provides SUSE-specific overrides of the Distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Suse; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +use File::Path; + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +### interface methods +################################################################################ + +sub GDMPathInfo +{ + my $self = shift; + + my $pathInfo = $self->SUPER::GDMPathInfo(); + + # create gdm.conf-custom instead of gdm.conf + $pathInfo->{config} = '/etc/gdm/custom.conf'; + + return $pathInfo; +} + +sub setupGDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $script = $self->SUPER::setupGDMScript($repoPath); + + my $configFile = $self->GDMPathInfo->{config}; + + # include common stuff (independent of display manager used) + $script = _setupCommonDmScript($script); + + $script .= unshiftHereDoc(<<' End-of-Here'); + echo -e '# changed by $0 during stage3 setup\nDISPLAYMANAGER="gdm"' \ + >/mnt/etc/sysconfig/displaymanager + sed -i "s/DEFAULT_WM=.*/DEFAULT_WM=\"$desktop_kind\"/" \ + /mnt/etc/sysconfig/windowmanager + #sed "s|XSESSION|/etc/xdm/Xsession|" -i /mnt$configFile + # gdm does not like AUFS/UnionFS on its var directory + rm -rf /mnt/var/lib/gdm + mkdir -m 1770 /mnt/var/lib/gdm + chown root:gdm /mnt/var/lib/gdm + # no use for this configuration info file + rm /mnt/etc/gdm/gdm_sysconfig.* 2>/dev/null + End-of-Here + + return $script; +} + +sub GDMConfigHashForWorkstation +{ + my $self = shift; + + my $configHash = $self->SUPER::GDMConfigHashForWorkstation(); + $configHash->{'daemon'}->{SessionDesktopDir} = + '/etc/X11/session/:/usr/share/xsessions/'; + $configHash->{'daemon'}->{DefaultSession} = 'default.desktop'; + $configHash->{'daemon'}->{Greeter} = + '/usr/lib/gdm/gdmgreeter'; + + return $configHash; +} + +sub setupKDMScript +{ + my $self = shift; + my $repoPath = shift; + + # check for kdm version + my $kdmVer; + my $kdmPath; + if (-e "/usr/bin/kdm") { + $kdmVer = "4"; + $kdmPath = "/usr/share/kde4"; + } + else { + $kdmVer = ""; + $kdmPath = "/opt/kde3/share"; + # change default theme to openslx-legacy if kdm3 + print " * Please change to openslx-legacy theme when using kdm3\n"; + } + + # SUSE reads /var/adm/kdm/kdmrc.sysconfig, so we link that to + # our config file + my $pathInfo = $self->KDMPathInfo(); + my $configFile = $pathInfo->{config}; + mkpath("/etc/opt/kdm"); + mkpath("/var/adm/kdm"); + # maybe backup kdmrc.sysconfig sometimes + unlink("/var/adm/kdm/kdmrc.sysconfig"); + # the config file gets overwritten if this script is present + unlink("$kdmPath/apps/kdm/read_sysconfig.sh"); + symlink("/etc/opt/kdm/kdmrc", "/var/adm/kdm/kdmrc.sysconfig"); + + my $script = $self->SUPER::setupKDMScript($repoPath); + + # include common stuff (independent of display manager used) + $script = _setupCommonDmScript($script); + + $script .= "kdmver=$kdmVer\n"; + $script .= unshiftHereDoc(<<' End-of-Here'); + sed -i "s/DISPLAYMANAGER=.*/DISPLAYMANAGER=\"kdm$kdmver\"/" \ + /mnt/etc/sysconfig/displaymanager + [ $(grep -q DISPLAYMANAGER /mnt/etc/sysconfig/displaymanager) ] && \ + echo "DISPLAYMANAGER=\"kdm$kdmver\"" >>/mnt/etc/sysconfig/displaymanager + sed -i "s/DEFAULT_WM=.*/DEFAULT_WM=\"$desktop_kind\"/" \ + /mnt/etc/sysconfig/windowmanager + # needed for compatibility X11/session(s) + ln -s /etc/X11/session /mnt/etc/X11/sessions + End-of-Here + + return $script; +} + +sub _setupCommonDmScript +{ + my $script = shift; + + $script .= unshiftHereDoc(<<' End-of-Here'); + rllinker xdm 1 10 + # cleanup after users Xorg session + sed 's,^#!.*,,' /mnt/etc/X11/xdm/Xreset \ + > /mnt/etc/X11/xdm/Xreset.system + echo -e '#!/bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n + # avoid annoying messages on removed sound devices + ( su -c "rm ~/.kde4/share/config/phonondevicesrc" - $USER ) & + + # remove safely any remaining files of the leaving user in /tmp + ( su -c "rm -rf /tmp/*" - $USER + echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null + chmod 0400 /tmp/files.removed ) & + . /etc/X11/xdm/Xreset.system' >/mnt/etc/X11/xdm/Xreset + chmod a+x /mnt/etc/X11/xdm/Xreset* + + End-of-Here + + return $script; +} + +1; diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm new file mode 100644 index 00000000..ac14b2a5 --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm @@ -0,0 +1,54 @@ +# Copyright (c) 2006..2010 - 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; +} + +sub GDMConfigHashForWorkstation +{ + my $self = shift; + + my $configHash = $self->SUPER::GDMConfigHashForWorkstation(); + $configHash->{'daemon'}->{SessionDesktopDir} = + '/etc/X11/session/:/usr/share/xsessions/'; + $configHash->{'daemon'}->{Greeter} = + '/opt/gnome/lib/gdm/gdmgreeter'; + + return $configHash; +} + +1; diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm new file mode 100644 index 00000000..d222c102 --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm @@ -0,0 +1,169 @@ +# Copyright (c) 2006..2010 - 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/Ubuntu.pm +# - provides Ubuntu-specific overrides of the distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Ubuntu; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +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/gdm/custom.conf'; + + return $pathInfo; +} + +sub setupGDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $script = $self->SUPER::setupGDMScript($repoPath); + + my $configFile = $self->GDMPathInfo->{config}; + + $script .= unshiftHereDoc(<<' End-of-Here'); + # cleanup after users Xorg session + sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \ + >/mnt/etc/gdm/PostSession/Default.system + echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n + # remove safely any remaining files of the leaving user in /tmp + ( su -c "rm -rf /tmp/*" + echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) & + . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default + chmod a+x /mnt/etc/gdm/PostSession/Default* + # gdm should be started via upstart mechanism + mv /mnt/etc/init.inactive/gdm.conf /mnt/etc/init + echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager + # possible to do this directly? + chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity + chroot /mnt update-alternatives --set x-session-manager \ + /usr/bin/gnome-session + # gdm does not like AUFS/UnionFS on its var directory + rm -rf /mnt/var/lib/gdm + mkdir -m 1770 /mnt/var/lib/gdm + chown root:gdm /mnt/var/lib/gdm + #sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \ + # -i /mnt$configFile + End-of-Here + + return $script; +} + +sub KDMPathInfo +{ + my $self = shift; + + my $pathInfo = $self->SUPER::KDMPathInfo(); + + $pathInfo = { + config => "/etc/kde4/kdm/kdmrc", + paths => [ + '/var/lib/kdm', + '/var/run/kdm', + ], + }; + + return $pathInfo; +} + +sub GDMConfigHashForWorkstation +{ + my $self = shift; + + return { + 'chooser' => { + Multicast => 'false', + }, + 'daemon' => { + AutomaticLoginEnable => 'false', + Group => 'gdm', + User => 'gdm', + DefaultSession => 'default.desktop', + }, + 'security' => { + DisallowTCP => 'true', + }, + 'xdmcp' => { + Enable => 'false', + }, + }; +} + +sub KDMConfigHashForWorkstation +{ + my $self = shift; + + my $kdmVer = "4"; + my $configHash = $self->SUPER::KDMConfigHashForWorkstation(); + $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid"; + $configHash->{'General'}->{ServerVTs} = "-7"; + $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup"; + $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup"; + $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession"; + $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset"; + $configHash->{'X-:0-Core'}->{SessionsDirs} = + '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions'; + $configHash->{'X-:0-Core'}->{ServerAttempts} = "2"; + + return $configHash; +} + +sub setupKDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $kdmVer = "4"; + my $script = $self->SUPER::setupKDMScript($repoPath); + + $script .= "kdmver=$kdmVer\n"; + $script .= unshiftHereDoc(<<' End-of-Here'); + + # cleanup after users Xorg session + sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \ + >/mnt/etc/kde$kdmver/kdm/Xreset.system + echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n + # remove safely any remaining files of the leaving user in /tmp + ( su -c "rm -rf /tmp/*" - $USER + echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null + chmod 0400 /tmp/files.removed ) & + . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset + chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset* + + mv /mnt/etc/init.inactive/kdm.conf /mnt/etc/init + echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager + chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin + chroot /mnt update-alternatives --set x-session-manager \ + /usr/bin/startkde + End-of-Here + + return $script; +} + +1; diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm new file mode 100644 index 00000000..6f00f181 --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm @@ -0,0 +1,161 @@ +# Copyright (c) 2006..2010 - 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/Ubuntu_8.pm +# - provides Ubuntu-specific overrides of the distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Ubuntu_8; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +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/gdm/gdm.conf-custom'; + + return $pathInfo; +} + +sub setupGDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $script = $self->SUPER::setupGDMScript($repoPath); + + my $configFile = $self->GDMPathInfo->{config}; + + $script .= unshiftHereDoc(<<' End-of-Here'); + # cleanup after users Xorg session + sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \ + >/mnt/etc/gdm/PostSession/Default.system + echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n + # remove safely any remaining files of the leaving user in /tmp + ( su -c "rm -rf /tmp/*" + echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) & + . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default + chmod a+x /mnt/etc/gdm/PostSession/Default* + # gdm should be started after dbus/hal + rllinker gdm 5 10 + echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager + chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity + chroot /mnt update-alternatives --set x-session-manager \ + /usr/bin/gnome-session + # gdm does not like AUFS/UnionFS on its var directory + rm -rf /mnt/var/lib/gdm + mkdir -m 1770 /mnt/var/lib/gdm + chown root:gdm /mnt/var/lib/gdm + sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \ + -i /mnt$configFile + End-of-Here + + return $script; +} + +sub KDMPathInfo +{ + my $self = shift; + + my $pathInfo = $self->SUPER::KDMPathInfo(); + my $kdmVer = "3"; + + $pathInfo = { + config => "/etc/kde$kdmVer/kdm/kdmrc", + paths => [ + '/var/lib/kdm', + '/var/run/kdm', + ], + }; + + return $pathInfo; +} + +sub GDMConfigHashForWorkstation +{ + my $self = shift; + + my $configHash = $self->SUPER::GDMConfigHashForWorkstation(); + $configHash->{'daemon'}->{SessionDesktopDir} = + '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions/'; + + return $configHash; +} + +sub KDMConfigHashForWorkstation +{ + my $self = shift; + + my $kdmVer = "4"; + my $configHash = $self->SUPER::KDMConfigHashForWorkstation(); + $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid"; + $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup"; + $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup"; + $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession"; + $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset"; + $configHash->{'X-:0-Core'}->{SessionsDirs} = + '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions'; + $configHash->{'X-:0-Core'}->{ServerAttempts} = "2"; + + return $configHash; +} + +sub setupKDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $kdmVer = "4"; + my $script = $self->SUPER::setupKDMScript($repoPath); + + # change default theme to openslx-legacy if kdm3 + if ( $kdmVer == "3" ) { + print " * Please change to openslx-legacy theme when using kdm3\n"; + } + + $script .= "kdmver=$kdmVer\n"; + $script .= unshiftHereDoc(<<' End-of-Here'); + + # cleanup after users Xorg session + sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \ + >/mnt/etc/kde$kdmver/kdm/Xreset.system + echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n + # remove safely any remaining files of the leaving user in /tmp + ( su -c "rm -rf /tmp/*" - $USER + echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null + chmod 0400 /tmp/files.removed ) & + . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset + chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset* + + rllinker kdm 1 10 + echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager + chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin + chroot /mnt update-alternatives --set x-session-manager \ + /usr/bin/startkde + End-of-Here + + return $script; +} + +1; diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm new file mode 100644 index 00000000..1022d6e8 --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm @@ -0,0 +1,161 @@ +# Copyright (c) 2006..2010 - 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/Ubuntu_9_04.pm +# - provides Ubuntu-specific overrides of the distro API for the desktop +# plugin. +# ----------------------------------------------------------------------------- +package desktop::OpenSLX::Distro::Ubuntu_9_04; + +use strict; +use warnings; + +use base qw(desktop::OpenSLX::Distro::Base); + +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/gdm/gdm.conf-custom'; + + return $pathInfo; +} + +sub setupGDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $script = $self->SUPER::setupGDMScript($repoPath); + + my $configFile = $self->GDMPathInfo->{config}; + + $script .= unshiftHereDoc(<<' End-of-Here'); + # cleanup after users Xorg session + sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \ + >/mnt/etc/gdm/PostSession/Default.system + echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n + # remove safely any remaining files of the leaving user in /tmp + ( su -c "rm -rf /tmp/*" + echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) & + . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default + chmod a+x /mnt/etc/gdm/PostSession/Default* + # gdm should be started after dbus/hal + rllinker gdm 5 10 + echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager + chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity + chroot /mnt update-alternatives --set x-session-manager \ + /usr/bin/gnome-session + # gdm does not like AUFS/UnionFS on its var directory + rm -rf /mnt/var/lib/gdm + mkdir -m 1770 /mnt/var/lib/gdm + chown root:gdm /mnt/var/lib/gdm + sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \ + -i /mnt$configFile + End-of-Here + + return $script; +} + +sub KDMPathInfo +{ + my $self = shift; + + my $pathInfo = $self->SUPER::KDMPathInfo(); + my $kdmVer = "4"; + + $pathInfo = { + config => "/etc/kde$kdmVer/kdm/kdmrc", + paths => [ + '/var/lib/kdm', + '/var/run/kdm', + ], + }; + + return $pathInfo; +} + +sub GDMConfigHashForWorkstation +{ + my $self = shift; + + my $configHash = $self->SUPER::GDMConfigHashForWorkstation(); + $configHash->{'daemon'}->{SessionDesktopDir} = + '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions/'; + + return $configHash; +} + +sub KDMConfigHashForWorkstation +{ + my $self = shift; + + my $kdmVer = "4"; + my $configHash = $self->SUPER::KDMConfigHashForWorkstation(); + $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid"; + $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup"; + $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup"; + $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession"; + $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset"; + $configHash->{'X-:0-Core'}->{SessionsDirs} = + '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions'; + $configHash->{'X-:0-Core'}->{ServerAttempts} = "2"; + + return $configHash; +} + +sub setupKDMScript +{ + my $self = shift; + my $repoPath = shift; + + my $kdmVer = "4"; + my $script = $self->SUPER::setupKDMScript($repoPath); + + # change default theme to openslx-legacy if kdm3 + if ( $kdmVer == "3" ) { + print " * Please change to openslx-legacy theme when using kdm3\n"; + } + + $script .= "kdmver=$kdmVer\n"; + $script .= unshiftHereDoc(<<' End-of-Here'); + + # cleanup after users Xorg session + sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \ + >/mnt/etc/kde$kdmver/kdm/Xreset.system + echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n + # remove safely any remaining files of the leaving user in /tmp + ( su -c "rm -rf /tmp/*" - $USER + echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null + chmod 0400 /tmp/files.removed ) & + . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset + chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset* + + rllinker kdm 1 10 + echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager + chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin + chroot /mnt update-alternatives --set x-session-manager \ + /usr/bin/startkde + End-of-Here + + return $script; +} + +1; |