Simplify wayland-session patch for SHELL setting

epel9
Neal Gompa 4 years ago
parent 25138b1b93
commit bd01f7358e

@ -1,6 +1,6 @@
From 12d96497e9e60645b21bbe7b48eb160185c41ee5 Mon Sep 17 00:00:00 2001 From 0cd4e54b4a8656d9e131decc2cb9ca86bf82e81a Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com> From: Neal Gompa <ngompa13@gmail.com>
Date: Sun, 17 Jan 2021 11:35:11 -0500 Date: Sun, 17 Jan 2021 11:48:28 -0500
Subject: [PATCH] wayland-session: Ensure $SHELL remains correctly set Subject: [PATCH] wayland-session: Ensure $SHELL remains correctly set
In some circumstances, the effort of setting the environment In some circumstances, the effort of setting the environment
@ -8,74 +8,32 @@ correctly can wind up clobbering the user-specified shell. To
work around this issue, capture the shell setting in a variable work around this issue, capture the shell setting in a variable
and set it back at the end of environment and profile setup. and set it back at the end of environment and profile setup.
--- ---
data/scripts/wayland-session | 20 ++++++++++++++++++++ data/scripts/wayland-session | 7 +++++++
1 file changed, 20 insertions(+) 1 file changed, 7 insertions(+)
diff --git a/data/scripts/wayland-session b/data/scripts/wayland-session diff --git a/data/scripts/wayland-session b/data/scripts/wayland-session
index de4f519..11f8490 100755 index de4f519..1f90554 100755
--- a/data/scripts/wayland-session --- a/data/scripts/wayland-session
+++ b/data/scripts/wayland-session +++ b/data/scripts/wayland-session
@@ -8,6 +8,8 @@ @@ -6,6 +6,10 @@
# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org>
# Note that the respective logout scripts are not sourced. # Note that the respective logout scripts are not sourced.
+
+# Backup the user shell setting into SDDM specific variable
+SDDM_USER_SHELL=$SHELL
+
case $SHELL in case $SHELL in
*/bash) */bash)
+ # Backup the user shell setting into SDDM specific variable
+ SDDM_USER_SHELL=$SHELL
[ -z "$BASH" ] && exec $SHELL $0 "$@" [ -z "$BASH" ] && exec $SHELL $0 "$@"
set +o posix @@ -50,4 +54,7 @@ case $SHELL in
[ -f /etc/profile ] && . /etc/profile
@@ -18,8 +20,12 @@ case $SHELL in
elif [ -f $HOME/.profile ]; then
. $HOME/.profile
fi
+ # Restore user shell setting that may have been clobbered by setting environment
+ export SHELL=$SDDM_USER_SHELL
;;
*/zsh)
+ # Backup the user shell setting into SDDM specific variable
+ SDDM_USER_SHELL=$SHELL
[ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@"
[ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc
zhome=${ZDOTDIR:-$HOME}
@@ -29,24 +35,38 @@ case $SHELL in
[ -f $zdir/zlogin ] && . $zdir/zlogin
[ -f $zhome/.zlogin ] && . $zhome/.zlogin
emulate -R sh
+ # Restore user shell setting that may have been clobbered by setting environment
+ export SHELL=$SDDM_USER_SHELL
;;
*/csh|*/tcsh)
+ # Backup the user shell setting into SDDM specific variable
+ SDDM_USER_SHELL=$SHELL
# [t]cshrc is always sourced automatically.
# Note that sourcing csh.login after .cshrc is non-standard.
wlsess_tmp=`mktemp /tmp/wlsess-env-XXXXXX`
$SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $wlsess_tmp"
. $wlsess_tmp
rm -f $wlsess_tmp
+ # Restore user shell setting that may have been clobbered by setting environment
+ export SHELL=$SDDM_USER_SHELL
;;
*/fish)
+ # Backup the user shell setting into SDDM specific variable
+ SDDM_USER_SHELL=$SHELL
xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
$SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
. $xsess_tmp
rm -f $xsess_tmp
+ # Restore user shell setting that may have been clobbered by setting environment
+ export SHELL=$SDDM_USER_SHELL
;;
*) # Plain sh, ksh, and anything we do not know.
+ # Backup the user shell setting into SDDM specific variable
+ SDDM_USER_SHELL=$SHELL
[ -f /etc/profile ] && . /etc/profile
[ -f $HOME/.profile ] && . $HOME/.profile
+ # Restore user shell setting that may have been clobbered by setting environment
+ export SHELL=$SDDM_USER_SHELL
;; ;;
esac esac
+# Restore user shell setting that may have been clobbered by setting environment
+export SHELL=$SDDM_USER_SHELL
+
exec $@
-- --
2.29.2 2.29.2

Loading…
Cancel
Save