1#!/bin/sh 2# wayland-session - run as user 3# Copyright (C) 2015-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> 4 5# This file is extracted from kde-workspace (kdm/kfrontend/genkdmconf.c) 6# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org> 7 8# Note that the respective logout scripts are not sourced. 9case $SHELL in 10 */bash) 11 [ -z "$BASH" ] && exec $SHELL $0 "$@" 12 set +o posix 13 [ -f /etc/profile ] && . /etc/profile 14 if [ -f $HOME/.bash_profile ]; then 15 . $HOME/.bash_profile 16 elif [ -f $HOME/.bash_login ]; then 17 . $HOME/.bash_login 18 elif [ -f $HOME/.profile ]; then 19 . $HOME/.profile 20 fi 21 ;; 22*/zsh) 23 [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@" 24 [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc 25 zhome=${ZDOTDIR:-$HOME} 26 # zshenv is always sourced automatically. 27 [ -f $zdir/zprofile ] && . $zdir/zprofile 28 [ -f $zhome/.zprofile ] && . $zhome/.zprofile 29 [ -f $zdir/zlogin ] && . $zdir/zlogin 30 [ -f $zhome/.zlogin ] && . $zhome/.zlogin 31 emulate -R sh 32 ;; 33 */csh|*/tcsh) 34 # [t]cshrc is always sourced automatically. 35 # Note that sourcing csh.login after .cshrc is non-standard. 36 wlsess_tmp=`mktemp /tmp/wlsess-env-XXXXXX` 37 $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $wlsess_tmp" 38 . $wlsess_tmp 39 rm -f $wlsess_tmp 40 ;; 41 */fish) 42 xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX` 43 $SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp" 44 . $xsess_tmp 45 rm -f $xsess_tmp 46 ;; 47 *) # Plain sh, ksh, and anything we do not know. 48 [ -f /etc/profile ] && . /etc/profile 49 [ -f $HOME/.profile ] && . $HOME/.profile 50 ;; 51esac 52 53exec $@ 54