Maxime Gauduin pushed to branch main at Arch Linux / Packaging / Packages / 
lightdm


Commits:
75c048ca by nl6720 at 2023-12-07T18:43:02+02:00
Xsession: source shell startup files

LightDM does not source all of the login shell's startup files, only the
sh/bash specific ~/.profile. This means that environment variables and
etc. defined in e.g. ~/.zprofile are not set in the graphical session.

Fixes 
https://gitlab.archlinux.org/archlinux/packaging/packages/lightdm/-/issues/3

- - - - -


2 changed files:

- PKGBUILD
- Xsession


Changes:

=====================================
PKGBUILD
=====================================
@@ -58,7 +58,7 @@ b2sums=('SKIP'
         
'eb8341389e8654ecad5c9608c133f6d5c2c7611c75c97ad0b3244281b7f6d7605757207eaae29b4793fbe2ede9131df5cfe0c144abd52070ee93cf3e88c04974'
         
'9e7b4f2adacfa18e9c029f93b922da45e3326266495a1919465f299fa630d769eaaa2101d76966cea496f66c4bd8469c73ef55acde5cd19fa559921c192acd04'
         
'd404466a551a42ac486564c5016baaae2276ec4126ae237538836e27e58b645dccf3ad3197c5c89d637d9bb678c3d7c0568a114d22fea2abec2d5e4eb0fb2721'
-        
'7785c19bb2343732d75dd2abd744148ae8baa6d8ad2b295a8e28d5eb78d7bd525e17784ae8a75784ab4cdb3fde73c66789b1bc033c53dafe13f8d19988e5ba18')
+        
'c376a6426bfd9c8eddcd9cdd9fcde9d137ba297e467b6c3b24a0ca155accf9530d6f526f0338da22559e1e151e238192d3c47752d70e899f11eec1a768d1a822')
 
 prepare() {
   cd lightdm


=====================================
Xsession
=====================================
@@ -4,13 +4,44 @@
 
 echo "Running X session wrapper"
 
-# Load profile
-for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; 
do
-    if [ -f "$file" ]; then
-        echo "Loading profile from $file";
-        . "$file"
-    fi
-done
+# From https://github.com/sddm/sddm/blob/develop/data/scripts/Xsession
+# Note that the respective logout scripts are not sourced.
+case $SHELL in
+  */bash)
+    [ -z "$BASH" ] && exec $SHELL --login $0 "$@"
+    shopt -q login_shell || exec $SHELL --login $0 "$@"
+    set +o posix
+    ;;
+  */zsh)
+    [ -z "$ZSH_NAME" ] && exec $SHELL --login $0 "$@"
+    [[ -o login ]] || exec $SHELL --login $0 "$@"
+    emulate -R sh
+    ;;
+  */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
+    ;;
+  */fish)
+    [ -f /etc/profile ] && . /etc/profile
+    [ -f $HOME/.profile ] && . $HOME/.profile
+    xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
+    $SHELL --login -c "/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
+
+[ -f /etc/xprofile ] && . /etc/xprofile
+[ -f /usr/local/etc/xprofile ] && . /usr/local/etc/xprofile
+[ -f "$HOME/.xprofile" ] && . "$HOME/.xprofile"
 
 # Load resources
 for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/lightdm/-/commit/75c048cabfe9693749f5f363ab6257400d954ffa

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/lightdm/-/commit/75c048cabfe9693749f5f363ab6257400d954ffa
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to