Group :: System/Servers
RPM: x2goserver
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: x2goserver-alt-Xsession.patch
Download
Download
diff --git a/x2goserver-xsession/etc/Xsession b/x2goserver-xsession/etc/Xsession
index 346d004..e2f6b43 100755
--- a/x2goserver-xsession/etc/Xsession
+++ b/x2goserver-xsession/etc/Xsession
@@ -49,16 +49,58 @@ internal_errormsg () {
"<x2go-dev@lists.x2go.org>."
}
-# Load profile
-for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
- if [ -f "$file" ]; then
- echo "Loading profile from $file";
- set +e
- . "$file"
- set -e
+# Emulate which(1) internally.
+absolute()
+{
+ local WHICH
+
+ [ -n "$1" ] || return 1
+ WHICH="$(type -p "$1")" || return 1
+ [ "$WHICH" != "${WHICH##/}" ] || return 1
+ [ -x "$WHICH" ] || return 1
+
+ printf %s "$WHICH"
+}
+
+SourceIfNotEmpty()
+{
+ local f="$1"
+ shift
+ [ -s "$f" ] && . "$f" "$@"
+}
+
+RunIfExecutable()
+{
+ local f="$1"
+ shift
+ f="$(absolute "$f")" && [ -x "$f" ] && "$f" "$@"
+}
+
+# Source shell scripts from system /etc/X11/profile.d/
+for f in /etc/X11/profile.d/*.sh; do
+ # Don't run *.rpm* and *~ scripts
+ [ "${f%.rpm*}" = "$f" -a "${f%\~}" = "$f" ] || continue
+
+ SourceIfNotEmpty "$f" "$@"
+done
+
+# Source shell scripts from user ~/.xprofile
+SourceIfNotEmpty "$HOME"/.xprofile "$@"
+
+# Run system scripts from /etc/X11/xinit.d/
+for f in /etc/X11/xinit.d/*; do
+ # Don't run *.rpm* and *~ scripts
+ [ "${f%.rpm*}" = "$f" -a "${f%\~}" = "$f" ] || continue
+
+ if [ -x "$f" ]; then
+ "$f" &
fi
done
+RunIfExecutable /etc/X11/xinit/xrandrrc
+RunIfExecutable /etc/X11/xinit/fixkeyboard
+RunIfExecutable /etc/X11/xinit/XIM
+
cur_hostname="$(hostname)"
if [ -z "${cur_hostname}" ] || [ "${cur_hostname}" = "(none)" ] || [ "${cur_hostname}" = "localhost" ]; then
errormsg "Hostname not set correctly; aborting."
@@ -152,13 +181,6 @@ elif [ -f /etc/redhat-release ] || [ -f /etc/gentoo-release ] || [ -f /etc/SUSE-
# Xclients.d scripts (also rarely used, see below...).
XSESSION_EXEC=${XSESSION_EXEC:-xterm}
- # Set up i18n environment
- if [ -r /etc/profile.d/lang.sh ]; then
- set +e
- . /etc/profile.d/lang.sh
- set -e
- fi
-
# merge in defaults
[ -r "$SYSRESOURCES" ] && xrdb -nocpp -merge "$SYSRESOURCES"
[ -r "$USRRESOURCES" ] && xrdb -merge "$USRRESOURCES"
@@ -199,16 +221,6 @@ elif [ -f /etc/redhat-release ] || [ -f /etc/gentoo-release ] || [ -f /etc/SUSE-
set -e
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 [ "x$TMPDIR" != "x" ]; then
- SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR"
- else
- SSH_AGENT="/usr/bin/ssh-agent"
- fi
- fi
-
CK_XINIT_SESSION=
if [ -x /usr/bin/ck-xinit-session -a -z "$XDG_SESSION_COOKIE" ]; then
CK_XINIT_SESSION="/usr/bin/ck-xinit-session"