From fc14af5d2f0696f9fef222b555aca093c6b2fe6e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 4 Apr 2013 17:48:34 +0200 Subject: Fix Xsession startup, fix polkit+rsyslog on suse --- remote/modules/kdm/data/etc/kde4/kdm/Xsession | 48 +++++++++ .../data/etc/systemd/system/polkitd.service | 7 ++ .../data/lib/systemd/system/polkitd.service | 7 -- remote/modules/policykit/policykit.build | 5 +- remote/modules/rsyslogd/rsyslogd.conf.zypper | 2 + remote/modules/xorg/data/etc/X11/Xsession | 119 +++++++++++++++++++++ .../xorg/data/usr/share/xsessions/gnome.desktop | 9 ++ 7 files changed, 188 insertions(+), 9 deletions(-) create mode 100755 remote/modules/kdm/data/etc/kde4/kdm/Xsession create mode 100644 remote/modules/policykit/data/etc/systemd/system/polkitd.service delete mode 100644 remote/modules/policykit/data/lib/systemd/system/polkitd.service create mode 100644 remote/modules/rsyslogd/rsyslogd.conf.zypper create mode 100755 remote/modules/xorg/data/etc/X11/Xsession create mode 100644 remote/modules/xorg/data/usr/share/xsessions/gnome.desktop (limited to 'remote') diff --git a/remote/modules/kdm/data/etc/kde4/kdm/Xsession b/remote/modules/kdm/data/etc/kde4/kdm/Xsession new file mode 100755 index 00000000..edff71a3 --- /dev/null +++ b/remote/modules/kdm/data/etc/kde4/kdm/Xsession @@ -0,0 +1,48 @@ +#! /bin/sh +# Xsession - run as user + +session=$1 + +# Note that the respective logout scripts are not sourced. +case $SHELL in + */bash) + [ -z "$BASH" ] && exec $SHELL $0 "$@" + set +o posix + [ -f /etc/profile ] && . /etc/profile + if [ -f $HOME/.bash_profile ]; then + . $HOME/.bash_profile + elif [ -f $HOME/.bash_login ]; then + . $HOME/.bash_login + elif [ -f $HOME/.profile ]; then + . $HOME/.profile + fi + ;; + */zsh) + [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@" + emulate -R zsh + [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc + zhome=${ZDOTDIR:-$HOME} + # zshenv is always sourced automatically. + [ -f $zdir/zprofile ] && . $zdir/zprofile + [ -f $zhome/.zprofile ] && . $zhome/.zprofile + [ -f $zdir/zlogin ] && . $zdir/zlogin + [ -f $zhome/.zlogin ] && . $zhome/.zlogin + setopt shwordsplit noextendedglob + ;; + */csh|*/tcsh) + # [t]cshrc is always sourced automatically. + # Note that sourcing csh.login after .cshrc is non-standard. + xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX` + $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $xsess_tmp" + . $xsess_tmp + rm -f $xsess_tmp + ;; + *) # Plain sh, ksh, and anything we do not know. + [ -f /etc/profile ] && . /etc/profile + [ -f $HOME/.profile ] && . $HOME/.profile + ;; +esac + +# invoke global X session script +. /etc/X11/Xsession + diff --git a/remote/modules/policykit/data/etc/systemd/system/polkitd.service b/remote/modules/policykit/data/etc/systemd/system/polkitd.service new file mode 100644 index 00000000..2aeb3c48 --- /dev/null +++ b/remote/modules/policykit/data/etc/systemd/system/polkitd.service @@ -0,0 +1,7 @@ +[Unit] +Description=Authenticate and Authorize Users to Run Privileged Tasks + +[Service] +Type=dbus +BusName=org.freedesktop.PolicyKit1 +ExecStart=%%POLKITD%% --no-debug diff --git a/remote/modules/policykit/data/lib/systemd/system/polkitd.service b/remote/modules/policykit/data/lib/systemd/system/polkitd.service deleted file mode 100644 index d3f192d1..00000000 --- a/remote/modules/policykit/data/lib/systemd/system/polkitd.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Authenticate and Authorize Users to Run Privileged Tasks - -[Service] -Type=dbus -BusName=org.freedesktop.PolicyKit1 -ExecStart=/usr/lib/policykit-1/polkitd --no-debug diff --git a/remote/modules/policykit/policykit.build b/remote/modules/policykit/policykit.build index b6b70b7f..7c2f3991 100644 --- a/remote/modules/policykit/policykit.build +++ b/remote/modules/policykit/policykit.build @@ -6,7 +6,7 @@ fetch_source () { } build () { - COPYLIST="list_dpkg_output" + COPYLIST="$MODULE_DIR/list_dpkg_output" [ -e "${COPYLIST}" ] && rm "${COPYLIST}" list_packet_files >> "${COPYLIST}" @@ -14,7 +14,8 @@ build () { } post_copy() { - + local POLPATH="$(grep '/polkitd$' "$COPYLIST" | head -1 | sed -e 's/[\/&]/\\&/g')" + sed -i "s/%%POLKITD%%/${POLPATH}/g" "$TARGET_BUILD_DIR/etc/systemd/system/polkitd.service" #Add Polkit User/Group/Shadow to Stage3.2 pinfo "Adding polkitd user to target system..." add_user "polkitd" diff --git a/remote/modules/rsyslogd/rsyslogd.conf.zypper b/remote/modules/rsyslogd/rsyslogd.conf.zypper new file mode 100644 index 00000000..c41d7922 --- /dev/null +++ b/remote/modules/rsyslogd/rsyslogd.conf.zypper @@ -0,0 +1,2 @@ +REQUIRED_DIRECTORIES=" /etc/rsyslog.d + /lib/rsyslog" diff --git a/remote/modules/xorg/data/etc/X11/Xsession b/remote/modules/xorg/data/etc/X11/Xsession new file mode 100755 index 00000000..6b071c74 --- /dev/null +++ b/remote/modules/xorg/data/etc/X11/Xsession @@ -0,0 +1,119 @@ +#!/bin/sh +# +# /etc/X11/Xsession +# +# global Xsession file -- used by display managers and xinit (startx) + +# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $ + +set -e + +PROGNAME=Xsession + +message () { + # pretty-print messages of arbitrary length; use xmessage if it + # is available and $DISPLAY is set + MESSAGE="$PROGNAME: $*" + echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2 + if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then + echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file - + fi +} + +message_nonl () { + # pretty-print messages of arbitrary length (no trailing newline); use + # xmessage if it is available and $DISPLAY is set + MESSAGE="$PROGNAME: $*" + echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2; + if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then + echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file - + fi +} + +errormsg () { + # exit script with error + message "$*" + exit 1 +} + +internal_errormsg () { + # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message + # One big call to message() for the sake of xmessage; if we had two then + # the user would have dismissed the error we want reported before seeing the + # request to report it. + errormsg "$*" \ + "Please report the installed version of the \"x11-common\"" \ + "package and the complete text of this error message to" \ + "." +} + +# initialize variables for use by all session scripts + +OPTIONFILE=/etc/X11/Xsession.options + +SYSRESOURCES=/etc/X11/Xresources +USRRESOURCES=$HOME/.Xresources + +SYSSESSIONDIR=/etc/X11/Xsession.d +USERXSESSION=$HOME/.xsession +USERXSESSIONRC=$HOME/.xsessionrc +ALTUSERXSESSION=$HOME/.Xsession +ERRFILE=$HOME/.xsession-errors + +# attempt to create an error file; abort if we cannot +if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] && + [ ! -L "$ERRFILE" ]; then + chmod 600 "$ERRFILE" +elif ERRFILE=$(tempfile 2> /dev/null); then + if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then + message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \ + "\"$ERRFILE\"; look for session log/errors in" \ + "\"$TMPDIR/xsession-$USER\"." + fi +else + errormsg "unable to create X session log/error file; aborting." +fi + +# truncate ERRFILE if it is too big to avoid disk usage DoS +if [ "`stat -c%s \"$ERRFILE\"`" -gt 500000 ]; then + T=`mktemp -p "$HOME"` + tail -c 500000 "$ERRFILE" > "$T" && mv -f "$T" "$ERRFILE" || rm -f "$T" +fi + +exec >>"$ERRFILE" 2>&1 + +echo "$PROGNAME: X session started for $LOGNAME at $(date)" + +# sanity check; is our session script directory present? +if [ ! -d "$SYSSESSIONDIR" ]; then + errormsg "no \"$SYSSESSIONDIR\" directory found; aborting." +fi + +# Attempt to create a file of non-zero length in /tmp; a full filesystem can +# cause mysterious X session failures. We do not use touch, :, or test -w +# because they won't actually create a file with contents. We also let standard +# error from tempfile and echo go to the error file to aid the user in +# determining what went wrong. +WRITE_TEST=$(tempfile) +if ! echo "*" >>"$WRITE_TEST"; then + message "warning: unable to write to ${WRITE_TEST%/*}; X session may exit" \ + "with an error" +fi +rm -f "$WRITE_TEST" + +# use run-parts to source every file in the session directory; we source +# instead of executing so that the variables and functions defined above +# are available to the scripts, and so that they can pass variables to each +# other +SESSIONFILES=$(run-parts --list $SYSSESSIONDIR) +if [ -n "$SESSIONFILES" ]; then + set +e + for SESSIONFILE in $SESSIONFILES; do + . $SESSIONFILE + done + set -e +fi + +exit 0 + +# vim:set ai et sts=2 sw=2 tw=80: diff --git a/remote/modules/xorg/data/usr/share/xsessions/gnome.desktop b/remote/modules/xorg/data/usr/share/xsessions/gnome.desktop new file mode 100644 index 00000000..cdc66661 --- /dev/null +++ b/remote/modules/xorg/data/usr/share/xsessions/gnome.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +X-SuSE-translate=true +Encoding=UTF-8 +Type=XSession +Exec=gnome-session +#TryExec=gnome-session +Name=GNOME +Comment=The GNU Network Object Model Environment. A complete, free and easy-to-use desktop environment + -- cgit v1.2.3-55-g7522