summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm
blob: 1c78b0c5dbf00a6889b9ecf46c89065544211e8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# 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/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/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");
        rllinker gdm 1 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
        testmkd /mnt/var/lib/gdm root:gdm 1770
        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/kde3/kdm/kdmrc',
        paths => [
            '/var/lib/kdm',
            '/var/run/kdm',
        ],
    };

    return $pathInfo;
}

sub GDMConfigHashForWorkstation
{
    my $self = shift;

    my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
    $configHash->{'daemon'}->{SessionDesktopDir} = 
        '/usr/share/gdm/BuiltInSessions/:/usr/share/xsessions/:/etc/X11/sessions/';

    return $configHash;
}

sub KDMConfigHashForWorkstation
{
    my $self = shift;
    
    my $configHash = $self->SUPER::KDMConfigHashForWorkstation();
    $configHash->{'General'}->{PidFile} = '/var/run/kdm.pid';
    $configHash->{'X-:0-Core'}->{Setup} = '/etc/kde3/kdm/Xsetup';
    $configHash->{'X-:0-Core'}->{Startup} = '/etc/kde3/kdm/Xstartup';
    $configHash->{'X-:0-Core'}->{Session} = '/etc/kde3/kdm/Xsession';
    $configHash->{'X-:0-Core'}->{Reset} = '/etc/kde3/kdm/Xreset';
    $configHash->{'X-:0-Core'}->{SessionsDirs} = 
        '/usr/share/xsessions,/usr/share/apps/kdm/sessions,/etc/X11/sessions';

    return $configHash;
}

sub setupKDMScript
{
    my $self     = shift;
    my $repoPath = shift;

    my $script = $self->SUPER::setupKDMScript($repoPath);
    
    $script .= unshiftHereDoc(<<'    End-of-Here');
        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;
}

sub setupKDEHOME
{
    my $self     = shift;
    my $path     = "/etc/profile.d/kde.sh";

    my $script = unshiftHereDoc(<<'    End-of-Here');
        export KDEHOME=".kde-$(kde-config -v | grep KDE | \
            awk {'print $2'})-ubuntu"
    End-of-Here

    spitFile($path, $script);
    system('grep -q "mkdir -m 700 -p \$kdehome/share/apps" /usr/bin/startkde ||\
        sed -i -e "s,mkdir -m 700 -p \$kdehome/share/config,\
mkdir -m 700 -p \$kdehome/share/config\nmkdir -m 700 -p \$kdehome/share/apps," \
        /usr/bin/startkde');

    return;
}

1;