Commit 1b4dcf40 authored by Michael Pyne's avatar Michael Pyne
Browse files

xsession: Split user env settings to yet-another file.

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.
parent 9e0130f9
......@@ -6658,6 +6658,7 @@ sub installCustomSessionDriver
{
use FindBin qw($RealBin);
use List::Util qw(first);
use File::Copy qw(copy);
my $ctx = assert_isa(shift, 'ksb::BuildContext');
my @xdgDataDirs = split(':', $ENV{XDG_DATA_DIRS} || '/usr/local/share/:/usr/share/');
......@@ -6675,6 +6676,9 @@ sub installCustomSessionDriver
my $sessionScript = first { -f $_ } (
map { "$_/sample-xsession.sh" } @searchPaths
);
my $userSample = first { -f $_ } (
map { "$_/sample-kde-env-user.sh" } @searchPaths
);
if (!$envScript || !$sessionScript) {
warning ("b[*] Unable to find helper files to setup a login session.");
......@@ -6688,6 +6692,13 @@ sub installCustomSessionDriver
'xsession-digest');
if (!pretending()) {
if (! -e "$ENV{HOME}/.kde-env-user.sh") {
copy($userSample, "$ENV{HOME}/.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");
};
}
chmod (0744, "$ENV{HOME}/.xsession") or do {
error ("\tb[r[*] Error making b[~/.xsession] executable: $!");
error ("\tb[r[*] If this file is not executable you may not be able to login!");
......
......@@ -526,6 +526,11 @@ $ENV{KDESRC_BUILD_TESTING} = 1; # Tell sample-xsession.sh not to run.
is(system('/bin/sh', '-u', "$RealBin/sample-kde-env-master.sh"), 0,
'env-master unset variable check');
# 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');
# 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');
......
......@@ -11,8 +11,18 @@
#
# Use by copying this script to ~/.kde-env-master (this will be done for you by
# kdesrc-build and/or kdesrc-build-setup, later).
#
# NOTHING IN THIS FILE IS MODIFIABLE, OTHERWISE WARNINGS WILL BE GENERATED
# === Load user environment settings (i.e. not set through kdesrc-buildrc)
# ALL USER MODS GO HERE ↴
if test -f "$HOME/.kde-env-user.sh"; then
. "$HOME/.kde-env-user.sh"
fi
# === User-modifiable variables. Should be set automatically by kdesrc-build.
# === Modifiable variables. Should be set automatically by kdesrc-build based
# on kdesrc-buildrc settings. Nothing below this line is user-modifiable!
# kdesrc-build: filter | The KDESRC_BUILD_TESTING stuff is to allow the script to
# kdesrc-build: filter | be executable by testsuite. It is filtered from destination.
......@@ -28,21 +38,12 @@ kde_prefix="$HOME/kde" # kdesrc-build: filter
qt_prefix="$HOME/qt4" # kdesrc-build: filter
fi # kdesrc-build: filter
# Directory to use for KDE configuration and other user customizations.
KDEHOME="$HOME/.kde4-self" # Or perhaps "$HOME/.kde-selfmade", etc.
# "Bitness" suffix to use for library directories. If left blank, will try to
# auto-detect from installed KDE's compiled defaults, which may still leave
# this blank.
lib_suffix="" # Or 32, or 64, as appropriate for your system.
# Additional paths to add to PATH, can be left blank.
user_path="" # Set to colon-separated PATH to add to the Qt/KDE paths.
# If more user customizations to the environment are needed, you can "source"
# this file from a more-specific file such as .bashrc, .profile, etc.
# === End of modifiable variables.
# === End of user-modifiable variables.
# Set defaults if these are unset or null. ':' is a null command
: ${lib_suffix:=""}
: ${user_path:=""}
: ${KDEHOME:="$HOME/.kde4-self"}
# Find system Qt
if test -z "$qt_prefix"; then
......
#!/bin/sh
#
# This is a sample user customization script. Unlike other example environment
# 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
# As long as it is found here, the kdesrc-build sample session and environment
# setup scripts will pull in settings from that file first.
### Variables supported by the environment script:
# Directory to use for KDE configuration and other user customizations.
# Syntax uses existing value if set, otherwise sets a different one.
# You can also leave blank, but this risks interfering with system KDE.
KDEHOME="$HOME/.kde4-self"
# "Bitness" suffix to use for library directories. If left blank, will try to
# auto-detect from installed KDE's compiled defaults, which may still leave
# this blank.
lib_suffix="" # Or 32, or 64, as appropriate for your system.
# lib_suffix="32"
# lib_suffix="64"
# Additional paths to add to PATH, can be left blank.
user_path="" # Set to colon-separated PATH to add to the Qt/KDE paths.
### KDE-specific environment variables:
# KDE supports various environment variables that might be useful for your
# kdesrc-build desktop. See also:
# http://techbase.kde.org/KDE_System_Administration/Environment_Variables
KDE_COLOR_DEBUG=1
export KDE_COLOR_DEBUG # Be sure to "export" variables you set yourself.
# If more user customizations to the environment are needed, you can add them
# here.
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