From 6bac51b34ea43ff90e1df02c7ed75db2ac6c8dd6 Mon Sep 17 00:00:00 2001 From: Dirk Date: Fri, 25 Nov 2011 18:30:16 +0100 Subject: Systemd stuff for SuSE 12.1 ... --- src/initramfs/distro-specs/suse/functions-12.1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/initramfs/distro-specs/suse/functions-12.1 b/src/initramfs/distro-specs/suse/functions-12.1 index 98daafa4..bb275ef8 100644 --- a/src/initramfs/distro-specs/suse/functions-12.1 +++ b/src/initramfs/distro-specs/suse/functions-12.1 @@ -22,6 +22,25 @@ # D_DIRINDXS - directories in client filesystem which should be present # anyhow +# distro specific function called from servconfig script +config_distro () { +# clean the runlevel directories which will be populated by the stage3 setup +rm -rf /mnt/etc/init.d* +touch /mnt/var/log/btmp +touch /mnt/var/log/lastlog +for file in systemd-hostnamed.service dbus-org.freedesktop.hostname1.service \ + remount-rootfs.service avahi-dnsconfd.service fsck* \ + Network* postfix*; do /mnt/lib/systemd/system/${file} +done + +# enable magic sysrequest for the clients +sed -e "1i# /etc/sysctl.conf - modified by $0 version $version" \ + -e "s,kernel.sysrq =.*,kernel.sysrq = 1," \ + -i /mnt/etc/sysctl.conf + +} + + # start portmapper (needed at least for nfs and nis services) config_portmap () { # portmap is provided via rpcbind in suse 11.1,2,3,4 and 12.1 -- cgit v1.2.3-55-g7522 From 52fb9f021d4e8137351360ad3922a44fa3815b92 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Mon, 28 Nov 2011 12:36:37 +0100 Subject: suse12.1 - systemd stuff cont. --- src/initramfs/distro-specs/suse/functions-12.1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/initramfs/distro-specs/suse/functions-12.1 b/src/initramfs/distro-specs/suse/functions-12.1 index bb275ef8..399d703d 100644 --- a/src/initramfs/distro-specs/suse/functions-12.1 +++ b/src/initramfs/distro-specs/suse/functions-12.1 @@ -28,9 +28,14 @@ config_distro () { rm -rf /mnt/etc/init.d* touch /mnt/var/log/btmp touch /mnt/var/log/lastlog -for file in systemd-hostnamed.service dbus-org.freedesktop.hostname1.service \ +SERVICES="systemd-hostnamed.service dbus-org.freedesktop.hostname1.service \ remount-rootfs.service avahi-dnsconfd.service fsck* \ - Network* postfix*; do /mnt/lib/systemd/system/${file} + Network* postfix*"; +# translate wildcards +SERVICES=$(cd /mnt/systemd/system/ && ls -1 $SERVICES) +for file in $SERVICES; +do + ln -sf /dev/null /mnt/etc/systemd/system/${file} done # enable magic sysrequest for the clients -- cgit v1.2.3-55-g7522 From e349e0ae89a713423337c21d3b21d17e92eeb60d Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Mon, 28 Nov 2011 12:41:25 +0100 Subject: typo .. --- src/initramfs/distro-specs/suse/functions-12.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/initramfs/distro-specs/suse/functions-12.1 b/src/initramfs/distro-specs/suse/functions-12.1 index 399d703d..9572859a 100644 --- a/src/initramfs/distro-specs/suse/functions-12.1 +++ b/src/initramfs/distro-specs/suse/functions-12.1 @@ -32,7 +32,7 @@ SERVICES="systemd-hostnamed.service dbus-org.freedesktop.hostname1.service \ remount-rootfs.service avahi-dnsconfd.service fsck* \ Network* postfix*"; # translate wildcards -SERVICES=$(cd /mnt/systemd/system/ && ls -1 $SERVICES) +SERVICES=$(cd /mnt/lib/systemd/system/ && ls -1 $SERVICES) for file in $SERVICES; do ln -sf /dev/null /mnt/etc/systemd/system/${file} -- cgit v1.2.3-55-g7522 From caf9876e1e5bf56f0c92892737c62d2ae9d16923 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Mon, 28 Nov 2011 12:55:08 +0100 Subject: next test --- src/initramfs/distro-specs/suse/functions-12.1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/initramfs/distro-specs/suse/functions-12.1 b/src/initramfs/distro-specs/suse/functions-12.1 index 9572859a..a6b5db36 100644 --- a/src/initramfs/distro-specs/suse/functions-12.1 +++ b/src/initramfs/distro-specs/suse/functions-12.1 @@ -25,12 +25,14 @@ # distro specific function called from servconfig script config_distro () { # clean the runlevel directories which will be populated by the stage3 setup -rm -rf /mnt/etc/init.d* +#rm -rf /mnt/etc/init.d* touch /mnt/var/log/btmp touch /mnt/var/log/lastlog SERVICES="systemd-hostnamed.service dbus-org.freedesktop.hostname1.service \ remount-rootfs.service avahi-dnsconfd.service fsck* \ - Network* postfix*"; + Network* postfix* multi-user.target.wants/Network* \ + multi-user.target.wants/remote* default.target.wants/YaST2* \ + network.target.wants/Network*"; # translate wildcards SERVICES=$(cd /mnt/lib/systemd/system/ && ls -1 $SERVICES) for file in $SERVICES; -- cgit v1.2.3-55-g7522 From 48ab8f8aa6bdea343ec949fa4563ec588e0382da Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Mon, 28 Nov 2011 14:38:29 +0100 Subject: update rllinker for suse 12.1 --- src/initramfs/distro-specs/suse/functions-12.1 | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/initramfs/distro-specs/suse/functions-12.1 b/src/initramfs/distro-specs/suse/functions-12.1 index a6b5db36..3b05ca2d 100644 --- a/src/initramfs/distro-specs/suse/functions-12.1 +++ b/src/initramfs/distro-specs/suse/functions-12.1 @@ -25,16 +25,17 @@ # distro specific function called from servconfig script config_distro () { # clean the runlevel directories which will be populated by the stage3 setup -#rm -rf /mnt/etc/init.d* +rm -rf /mnt/etc/init.d* touch /mnt/var/log/btmp touch /mnt/var/log/lastlog SERVICES="systemd-hostnamed.service dbus-org.freedesktop.hostname1.service \ remount-rootfs.service avahi-dnsconfd.service fsck* \ - Network* postfix* multi-user.target.wants/Network* \ - multi-user.target.wants/remote* default.target.wants/YaST2* \ - network.target.wants/Network*"; + Network* postfix* *.wants/Network* \ + *.wants/remote* *.wants/YaST2*"; # translate wildcards -SERVICES=$(cd /mnt/lib/systemd/system/ && ls -1 $SERVICES) +SERVICES_LIB=$(cd /mnt/lib/systemd/system/ && for f in $SERVICES; do echo $f; done| grep -v '*') +SERVICES_ETC=$(cd /mnt/etc/systemd/system/ && for f in $SERVICES; do echo $f; done| grep -v '*') +SERVICES=$(echo -e "$SERVICES_ETC\n$SERVICES_LIB" | sort -u) for file in $SERVICES; do ln -sf /dev/null /mnt/etc/systemd/system/${file} @@ -48,6 +49,21 @@ sed -e "1i# /etc/sysctl.conf - modified by $0 version $version" \ } +# linking runlevel scripts +rllinker () { +local script="$1" +# empty runlevel links - decision on running certain services is +# passed via configuration +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 + ln -sf /lib/systemd/system/${script}.service \ + /mnt/etc/systemd/system/default.target.wants/${script}.service +fi +} + + # start portmapper (needed at least for nfs and nis services) config_portmap () { # portmap is provided via rpcbind in suse 11.1,2,3,4 and 12.1 -- cgit v1.2.3-55-g7522 From 20ed426e83b3e5d3bca8268f00cef7de4a881d01 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Mon, 28 Nov 2011 15:12:49 +0100 Subject: test systemd kdm startup script --- src/initramfs/distro-specs/suse/functions-12.1 | 13 +- .../plugins/desktop/OpenSLX/Distro/Suse_12.pm | 179 +++++++++++++++++++++ 2 files changed, 186 insertions(+), 6 deletions(-) create mode 100644 src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_12.pm (limited to 'src') 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; -- cgit v1.2.3-55-g7522