From ae42efc48beae3cf96c2262da7017a5225652e84 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 29 Jan 2010 09:33:32 +0000 Subject: [PATCH] Improvements to provided scripts (Resolves #549551) --- Xclients | 8 +++----- Xsession | 2 +- xinitrc-common | 5 ++--- xorg-x11-xinit.spec | 10 ++++++++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Xclients b/Xclients index fb4e15a..d2b81c7 100755 --- a/Xclients +++ b/Xclients @@ -8,8 +8,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -GSESSION="$(which gnome-session 2>/dev/null)" -STARTKDE="$(which startkde 2>/dev/null)" +GSESSION="$(type -p gnome-session)" +STARTKDE="$(type -p startkde)" # check to see if the user has a preferred desktop PREFERRED= @@ -39,7 +39,7 @@ fi # We should also support /etc/X11/xinit/Xclients.d scripts XCLIENTS_D=/etc/X11/xinit/Xclients.d -if [ -d "$XCLIENTS_D" -a "$#" -eq 1 -a -x "$XCLIENTS_D/Xclients.$1.sh" ]; then +if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh" fi @@ -56,8 +56,6 @@ rm -f $HOME/Xrootenv.0 if [ -x /usr/bin/xclock ] ; then /usr/bin/xclock -geometry 100x100-5+5 & - elif [ -x /usr/bin/xclock ] ; then - /usr/bin/xclock -geometry 100x100-5+5 & fi if [ -x /usr/bin/xterm ] ; then /usr/bin/xterm -geometry 80x50-50+150 & diff --git a/Xsession b/Xsession index e12e0ee..367a46d 100644 --- a/Xsession +++ b/Xsession @@ -40,7 +40,7 @@ SWITCHDESKPATH=/usr/share/switchdesk # and hard coded window managers and desktop environments will be removed from # this script. XCLIENTS_D=/etc/X11/xinit/Xclients.d -if [ -d "$XCLIENTS_D" -a "$#" -eq 1 -a -x "$XCLIENTS_D/Xclients.$1.sh" ]; then +if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $XCLIENTS_D/Xclients.$1.sh" else # now, we see if xdm/gdm/kdm has asked for a specific environment diff --git a/xinitrc-common b/xinitrc-common index a115a44..888c42a 100644 --- a/xinitrc-common +++ b/xinitrc-common @@ -1,4 +1,3 @@ -#!/bin/bash # Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This # copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the @@ -56,7 +55,7 @@ done # Prefix launch of session with ssh-agent if available and not already running. SSH_AGENT= -if [ -x /usr/bin/ssh-agent -a -z "$SSH_AGENT_PID" ]; then +if [ -z "$SSH_AGENT_PID" ] && [ -x /usr/bin/ssh-agent ]; then if [ "x$TMPDIR" != "x" ]; then SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR" else @@ -65,6 +64,6 @@ if [ -x /usr/bin/ssh-agent -a -z "$SSH_AGENT_PID" ]; then fi CK_XINIT_SESSION= -if [ -x /usr/bin/ck-xinit-session -a -z "$XDG_SESSION_COOKIE" ]; then +if [ -z "$XDG_SESSION_COOKIE" ] && [ -x /usr/bin/ck-xinit-session ]; then CK_XINIT_SESSION="/usr/bin/ck-xinit-session" fi diff --git a/xorg-x11-xinit.spec b/xorg-x11-xinit.spec index c156be0..4fef852 100644 --- a/xorg-x11-xinit.spec +++ b/xorg-x11-xinit.spec @@ -41,7 +41,6 @@ Requires: xauth Requires: coreutils Requires: xorg-x11-server-utils Requires: ConsoleKit-x11 -Requires: which # NOTE: Most of the xinitrc scripts/config files are now in xorg-x11-xinit, # so the xinitrc package became unnecessary. The xdm configs/scripts move @@ -90,7 +89,9 @@ install -m644 -D $RPM_SOURCE_DIR/xinit-compat.desktop $RPM_BUILD_ROOT%{_datadir} # Install Red Hat custom xinitrc, etc. { - for script in %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE16} ; do + install -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/X11/xinit/xinitrc-common + + for script in %{SOURCE11} %{SOURCE12} %{SOURCE16} ; do install -m 755 $script $RPM_BUILD_ROOT%{_sysconfdir}/X11/xinit/${script##*/} done @@ -131,6 +132,11 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/xsessions/xinit-compat.desktop %changelog +* Tue Dec 22 2009 Ville Skyttä +- Eliminate dependency on which. +- Change Xclients, Xsession and xinitrc-common to make fewer stat calls. +- Install xinitrc-common non-executable. + * Tue Nov 10 2009 Matěj Cepl - 1.0.9-13 - Fix SELinux labels on $errfile (fixes bug# 530419)