Summary: Otherwise if, those variables are set startkde doesn't add them in the XDG_* variables and it results in broken system
Test Plan: tested on wayland and normal session
Reviewers: mpyne
Differential Revision: https://phabricator.kde.org/D11039
This permits using path_add when the environment variable already contains
entries with characters that break shell quoting rules.
Technically we'd need to pipe to sed or similar to re-quote single quotes,
hopefully that won't come up...
The kde-env-user stuff is probably extraneous, users who will go through and
tweak the installed kde-env-master.sh script should be skilled enough to
already have their own .bashrc (or equivalent) and be able to setup their own
env vars prior to sourcing kde-env-master.sh
This also ports some of the Qt4/KDE4 stuff to Qt5/KF5, removes now-unnecessary
environment variable settings, etc.
No need to re-add /usr if it's already in PATH (and doing so can even
lead to changing a user's preferred PATH order, even though it's
possible to work around that issue by playing with user_path in
.config/kde-env-user.sh).
BUG:312122
FIXED-IN:1.16
This allows for having a "shell setup" script usable everywhere and
managed by kdesrc-build, and yet still allowing the user to add their
own settings automatically.
This "shell setup" file is then used by the "session setup" script, also
managed by kdesrc-build.
I think we're getting close to something generically usable by all.
dfaure reinforced a point I was thinking after doing testing on my
system... the environment variable-setting portion of the script needs
to be factored out into its own script so that it can be sourced easily
from login profile setup, shell setup, etc. and not just used from the
xsession startup.
It's still not active (but the code is used in the test suite), will try
to work on that tomorrow assuming the sequel to "Perfect Storm" about to
strike here in DC leaves me with power...
A few minor related changes are included. E.g. we actually want to pass
along blank lines, so remove that check (which didn't work anyways as \n
was still present).
We replace that with a simple filter in the template installation
process to allow there to be source lines in the base template that
don't get passed to the installed result. This allows for shell script
that prevents running the full command suite in the base without
affecting the installed script.
It is required to be able to actually run the base script as the "set
-u" check for unset variables doesn't work when "set -n" (syntax check)
is in use. These set commands can be passed directly to /bin/sh to have
them in effect when the script starts (and are both part of POSIX and
seem to work even with busybox sh).
Additionally, the path_add function needs to actually check for unset
variables now. Luckily there is existing Bourne shell syntax for that.
The observant reviewer will note that the testsuite does not currently
pass because there is a mispeled lib_suffix in the base, that will be
fixed in the next commit.
This isn't turned on yet (the testcase just tries to run the function
without exceptions), but this would be the base for a feature to install
the new sample .xsession file for the "Custom session" login option for
most login managers.
The base .xsession was graciously provided by Michael Janses (of
build-tool fame). I've simplified it a bit for kdesrc-build usage and
tried to make it compatible with less featureful shells. The eventual
idea is that it can be used with kdesrc-build-set and/or kdesrc-build so
that you can run the setup script, kdesrc-build, and be able to login to
your new KDE install.