Commit d72d6d75 authored by Michael Pyne's avatar Michael Pyne
Browse files

xsession: Use xdg-compliant paths.

As recommended/cheered-for by one of the few reviewers of this feature.
parent 620c661f
......@@ -6686,16 +6686,19 @@ sub installCustomSessionDriver
return;
}
installCustomFile($ctx, $envScript, "$ENV{HOME}/.kde-env-master.sh",
my $destDir = $ENV{XDG_CONFIG_HOME} || "$ENV{HOME}/.config";
super_mkdir($destDir) unless -d $destDir;
installCustomFile($ctx, $envScript, "$destDir/kde-env-master.sh",
'kde-env-master-digest');
installCustomFile($ctx, $sessionScript, "$ENV{HOME}/.xsession",
'xsession-digest');
if (!pretending()) {
if (! -e "$ENV{HOME}/.kde-env-user.sh") {
copy($userSample, "$ENV{HOME}/.kde-env-user.sh") or do {
if (! -e "$destDir/kde-env-user.sh") {
copy($userSample, "$destDir/kde-env-user.sh") or do {
warning ("b[*] Unable to install b[$userSample]: $!");
warning ("b[*] You should create b[~/.kde-env-user.sh] yourself or fix the error and re-run");
warning ("b[*] You should create b[~/.config/kde-env-user.sh] yourself or fix the error and re-run");
};
}
......
......@@ -517,36 +517,37 @@ SKIP: {
like ($newQMakePossibility, qr/^qmake/, 'qmake looks like an executable even in scalar context.');
}
# This test set must be run first as xsession depends on this env-master.
is(system('/bin/sh', '-n', "$RealBin/sample-kde-env-master.sh"), 0,
'env-master pre-install syntax check');
do {
local $ENV{HOME} = "$testSourceDirName"; # Search right spot for kde-env-master.sh
local $ENV{XDG_CONFIG_HOME} = $testSourceDirName;
$ENV{KDESRC_BUILD_TESTING} = 1; # Tell sample-xsession.sh not to run.
# This test set must be run first as xsession depends on this env-master.
is(system('/bin/sh', '-n', "$RealBin/sample-kde-env-master.sh"), 0,
'env-master pre-install syntax check');
is(system('/bin/sh', '-u', "$RealBin/sample-kde-env-master.sh"), 0,
'env-master unset variable check');
local $ENV{KDESRC_BUILD_TESTING} = 1; # Tell sample-xsession.sh not to run.
# Deliberately after env-master, env-master should have no unset variables if user doesn't set
# this up.
ok(File::Copy::copy("$RealBin/sample-kde-env-user.sh", "$testSourceDirName/.kde-env-user.sh"),
'env-user sample installation');
is(system('/bin/sh', '-u', "$RealBin/sample-kde-env-master.sh"), 0,
'env-master unset variable check');
# Ensure this function can run without throwing exception.
ok(installTemplatedFile("$RealBin/sample-kde-env-master.sh", "$testSourceDirName/.kde-env-master.sh", $ctx) || 1,
'env-master template installation');
# Deliberately after env-master, env-master should have no unset variables if user doesn't set
# this up.
ok(File::Copy::copy("$RealBin/sample-kde-env-user.sh", "$testSourceDirName/kde-env-user.sh"),
'env-user sample installation');
is(system('/bin/sh', '-n', "$RealBin/sample-xsession.sh"), 0,
'xsession pre-install syntax check');
# Ensure this function can run without throwing exception.
ok(installTemplatedFile("$RealBin/sample-kde-env-master.sh", "$testSourceDirName/kde-env-master.sh", $ctx) || 1,
'env-master template installation');
ok(File::Copy::copy("$RealBin/sample-xsession.sh", "$testSourceDirName/xsession.sh"),
'xsession installation');
is(system('/bin/sh', '-n', "$RealBin/sample-xsession.sh"), 0,
'xsession pre-install syntax check');
$ENV{KDESRC_BUILD_TESTING} = 1; # Tell sample-xsession.sh not to run.
is(system('/bin/sh', '-u', "$RealBin/sample-xsession.sh"), 0,
'xsession unset variable check');
ok(File::Copy::copy("$RealBin/sample-xsession.sh", "$testSourceDirName/xsession.sh"),
'xsession installation');
is(system('/bin/sh', '-u', "$RealBin/sample-xsession.sh"), 0,
'xsession unset variable check');
do {
local $ENV{HOME} = "$testSourceDirName"; # Search right spot for kde-env-master.sh
is(system('/bin/sh', '-n', "$testSourceDirName/xsession.sh"), 0,
'xsession post-install syntax check');
};
......
......@@ -9,16 +9,18 @@
#
# See also the sample xsession setup script which requires this file.
#
# Use by copying this script to ~/.kde-env-master (this will be done for you by
# kdesrc-build and/or kdesrc-build-setup, later).
# Use by copying this script to $XDG_CONFIG_HOME/kde-env-master.sh (this will
# be done for you by kdesrc-build and/or kdesrc-build-setup, later). 99% of the
# time this means ~/.config/kde-env-master.sh
#
# NOTHING IN THIS FILE IS MODIFIABLE, OTHERWISE WARNINGS WILL BE GENERATED
# === Load user environment settings (i.e. not set through kdesrc-buildrc)
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
# ALL USER MODS GO HERE ↴
if test -f "$HOME/.kde-env-user.sh"; then
. "$HOME/.kde-env-user.sh"
if test -f "$XDG_CONFIG_HOME/kde-env-user.sh"; then
. "$XDG_CONFIG_HOME/kde-env-user.sh"
fi
# === Modifiable variables. Should be set automatically by kdesrc-build based
......
......@@ -4,7 +4,9 @@
# setup files, this one can be modified by the user, and kdesrc-build will not
# warn about it or overwrite it.
#
# This file should be installed to ~/.kde-env-user.sh
# This file should be installed to $XDG_CONFIG_HOME/kde-env-user.sh (which
# normally means ~/.config/kde-env-user.sh)
#
# As long as it is found here, the kdesrc-build sample session and environment
# setup scripts will pull in settings from that file first.
......
......@@ -12,7 +12,9 @@
# .xsession-local, which will be sourced just prior to running KDE. This can
# read .bashrc, just set a few vars, etc.
. "$HOME/.kde-env-master.sh" # Should be installed by kdesrc-build
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
. "${XDG_CONFIG_HOME}/kde-env-master.sh" # Should be installed by kdesrc-build
# See .kde-env-master.sh for details on the kdesrc-build: filter stuff
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment