diff options
author | Sebastian Schmelzer | 2011-11-28 15:12:49 +0100 |
---|---|---|
committer | Sebastian Schmelzer | 2011-11-28 15:12:49 +0100 |
commit | 20ed426e83b3e5d3bca8268f00cef7de4a881d01 (patch) | |
tree | deae870de2f697b15a14f18c77c2d0483a36d99d | |
parent | update rllinker for suse 12.1 (diff) | |
download | core-20ed426e83b3e5d3bca8268f00cef7de4a881d01.tar.gz core-20ed426e83b3e5d3bca8268f00cef7de4a881d01.tar.xz core-20ed426e83b3e5d3bca8268f00cef7de4a881d01.zip |
test systemd kdm startup script
-rw-r--r-- | src/initramfs/distro-specs/suse/functions-12.1 | 13 | ||||
-rw-r--r-- | src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_12.pm | 179 |
2 files changed, 186 insertions, 6 deletions
diff --git a/src/initramfs/distro-specs/suse/functions-12.1 b/src/initramfs/distro-specs/suse/functions-12.1 index 3b05ca2d..5f11e0a3 100644 --- a/src/initramfs/distro-specs/suse/functions-12.1 +++ b/src/initramfs/distro-specs/suse/functions-12.1 @@ -57,7 +57,7 @@ local script="$1" if [ -f /mnt/etc/systemd/system/${script}.service ]; then ln -sf /etc/systemd/system/${script}.service \ /mnt/etc/systemd/system/default.target.wants/${script}.service -else if [ -f /mnt/lib/systemd/system/${script}.service ]; then +elif [ -f /mnt/lib/systemd/system/${script}.service ]; then ln -sf /lib/systemd/system/${script}.service \ /mnt/etc/systemd/system/default.target.wants/${script}.service fi @@ -68,15 +68,17 @@ fi config_portmap () { # portmap is provided via rpcbind in suse 11.1,2,3,4 and 12.1 testmkd /mnt/var/lib/rpcbind -rllinker "rpcbind" 4 5 +rllinker "rpcbind" } + # acpi and powersave daemons, required e.g. to shutdown the machine via # power button, no need for early start config_acpi () { -rllinker acpid 22 12 +rllinker acpid # dbus is required to run acpid and powersaved start_dreshal="yes" } + # configure dbus (inter application communication for kde and gnome), hal # (hardware abstraction layer - used e.g. by powersaved) config_dreshal () { @@ -92,7 +94,6 @@ if [ "x$start_dreshal" = "xyes" ]; then touch /mnt/var/lib/misc/PolicyKit.reload chown polkituser.polkituser /mnt/var/lib/misc/PolicyKit.reload - if [ -f /mnt/etc/init.d/dbus ] ; then strinfile "messagebus:" /mnt/etc/passwd || \ echo "messagebus:x:102:103:User for D-BUS:/var/run/dbus:/bin/false" \ >> /mnt/etc/passwd @@ -103,10 +104,10 @@ if [ "x$start_dreshal" = "xyes" ]; then /mnt/etc/dbus-1/system.d/nm-* rllinker "dbus" 1 20 - fi fi } # function for ntp configuration +#TODO: ntp we need a systemd startup script config_ntp () { if [ -e /mnt/etc/init.d/ntp ] ; then if ! strinfile "ntp:" /mnt/etc/passwd ; then @@ -118,7 +119,7 @@ if [ -e /mnt/etc/init.d/ntp ] ; then testmkd /mnt/var/db touch /mnt/var/db/ntp-kod if [ "x$start_ntp" = "xyes" ] ; then - rllinker "ntp" 2 14 + rllinker "ntp" fi fi } diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_12.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_12.pm new file mode 100644 index 00000000..badfcf7a --- /dev/null +++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_12.pm @@ -0,0 +1,179 @@ +# 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'); + cat > /mnt/etc/systemd/system/xdm@.service << EOF + [Unit] + Description=K Display Manager on %I + Requires=dev-%i.device + After=dev-%i.device + + [Service] + ExecStart=/usr/bin/kdm -nodaemon %I + StandardOutput=syslog + + [Install] + Alias=graphical.target.wants/kdm@tty7.service + EOF + + ln -sf /etc/systemd/system/xdm@.service \ + /mnt/etc/systemd/system/default.target.wants/xdm@tty7.service + + # 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; |