xsession: Use xdg-compliant paths.

As recommended/cheered-for by one of the few reviewers of this feature.
wilder
Michael Pyne 14 years ago
parent 620c661f9a
commit d72d6d7516
  1. 11
      kdesrc-build
  2. 45
      kdesrc-build-test.pl
  3. 10
      sample-kde-env-master.sh
  4. 4
      sample-kde-env-user.sh
  5. 4
      sample-xsession.sh

@ -6686,16 +6686,19 @@ sub installCustomSessionDriver
return; 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'); 'kde-env-master-digest');
installCustomFile($ctx, $sessionScript, "$ENV{HOME}/.xsession", installCustomFile($ctx, $sessionScript, "$ENV{HOME}/.xsession",
'xsession-digest'); 'xsession-digest');
if (!pretending()) { if (!pretending()) {
if (! -e "$ENV{HOME}/.kde-env-user.sh") { if (! -e "$destDir/kde-env-user.sh") {
copy($userSample, "$ENV{HOME}/.kde-env-user.sh") or do { copy($userSample, "$destDir/kde-env-user.sh") or do {
warning ("b[*] Unable to install b[$userSample]: $!"); 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.'); 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. do {
is(system('/bin/sh', '-n', "$RealBin/sample-kde-env-master.sh"), 0, local $ENV{HOME} = "$testSourceDirName"; # Search right spot for kde-env-master.sh
'env-master pre-install syntax check'); 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, local $ENV{KDESRC_BUILD_TESTING} = 1; # Tell sample-xsession.sh not to run.
'env-master unset variable check');
# Deliberately after env-master, env-master should have no unset variables if user doesn't set is(system('/bin/sh', '-u', "$RealBin/sample-kde-env-master.sh"), 0,
# this up. 'env-master unset variable check');
ok(File::Copy::copy("$RealBin/sample-kde-env-user.sh", "$testSourceDirName/.kde-env-user.sh"),
'env-user sample installation');
# Ensure this function can run without throwing exception. # Deliberately after env-master, env-master should have no unset variables if user doesn't set
ok(installTemplatedFile("$RealBin/sample-kde-env-master.sh", "$testSourceDirName/.kde-env-master.sh", $ctx) || 1, # this up.
'env-master template installation'); 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, # Ensure this function can run without throwing exception.
'xsession pre-install syntax check'); 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"), is(system('/bin/sh', '-n', "$RealBin/sample-xsession.sh"), 0,
'xsession installation'); 'xsession pre-install syntax check');
$ENV{KDESRC_BUILD_TESTING} = 1; # Tell sample-xsession.sh not to run. ok(File::Copy::copy("$RealBin/sample-xsession.sh", "$testSourceDirName/xsession.sh"),
is(system('/bin/sh', '-u', "$RealBin/sample-xsession.sh"), 0, 'xsession installation');
'xsession unset variable check');
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, is(system('/bin/sh', '-n', "$testSourceDirName/xsession.sh"), 0,
'xsession post-install syntax check'); 'xsession post-install syntax check');
}; };

@ -9,16 +9,18 @@
# #
# See also the sample xsession setup script which requires this file. # 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 # Use by copying this script to $XDG_CONFIG_HOME/kde-env-master.sh (this will
# kdesrc-build and/or kdesrc-build-setup, later). # 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 # NOTHING IN THIS FILE IS MODIFIABLE, OTHERWISE WARNINGS WILL BE GENERATED
# === Load user environment settings (i.e. not set through kdesrc-buildrc) # === Load user environment settings (i.e. not set through kdesrc-buildrc)
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
# ALL USER MODS GO HERE ↴ # ALL USER MODS GO HERE ↴
if test -f "$HOME/.kde-env-user.sh"; then if test -f "$XDG_CONFIG_HOME/kde-env-user.sh"; then
. "$HOME/.kde-env-user.sh" . "$XDG_CONFIG_HOME/kde-env-user.sh"
fi fi
# === Modifiable variables. Should be set automatically by kdesrc-build based # === 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 # setup files, this one can be modified by the user, and kdesrc-build will not
# warn about it or overwrite it. # 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 # As long as it is found here, the kdesrc-build sample session and environment
# setup scripts will pull in settings from that file first. # 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 # .xsession-local, which will be sourced just prior to running KDE. This can
# read .bashrc, just set a few vars, etc. # 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 # See .kde-env-master.sh for details on the kdesrc-build: filter stuff

Loading…
Cancel
Save