I am running LXDE/Openbox on Debian Linux. On logging in I want to:
- add a user specific directory to the $PATH variable (A)
- execute some (non-graphical) commands (e.g. mount directories) (B)
The setup should work for graphical login as well as login shells (e.g. SSH). Especially the part about extending the $PATH variable seems to be tricky...
My ideal solution would be to put all the commands (A and B) in a separate script file (F) and source it from .xsessionrc (for graphical login via the session manager) and .profile (for login shells).
Sourcing F from .profile works nicely, but sourcing from .xsessionrc seems to fail.
So I made the workaround to set the new $PATH directly in .xsessionrc (and also in .profile) and just execute F (now containing only the commands B) from .xsessionrc and .profile. This works fine, but is not really satisfactory, as I now some duplicate commands (A) in .xessionrc and .profile.
Is there some magic incanation that I have to do in order to source another file from .xsessionrc or are there any other obvious flaws in my thinking?
The setup should work for graphical login as well as login shells (e.g. ssh)login shells won't do anything with xsessionrc, seeing as you aren't starting X.