You are not logged in.

#1 2012-10-13 00:46:51

adrianbs
Member
From: Uruguay
Registered: 2009-08-13
Posts: 31

KDM not sourcing /etc/profile.d

I have a new installation of Arch/KDE. I'm using KDM to login started with inittab (I couldn't make it work with systemd).

I installed oracle jre from AUR. It installs the file /etc/profile.d/jre.sh which exports jre path, but in konsole I am not able to run java or javac. However if I login in a tty the file is sourced correctly (I have jre binaries in PATH).

In konsole I'm using zsh, but the same occurs with bash.

Anyone experienced this?

Offline

#2 2012-10-13 01:00:30

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: KDM not sourcing /etc/profile.d

Basically, it depends on the files the particular shells read at start up and this differs for login versus non-login shells, for example. These files are sourced for me but I have tweaked config files which ensure that /etc/profile is always sourced. If you ensure that, it will all work because that file will source the fragments in profile.d.

For example, I use

if [ -f "/etc/profile" ]
then
        [ -r /etc/profile ] && . /etc/profile
fi

in ~/.profile and

[[ -f ~/.profile ]] && . ~/.profile

[[ -f ~/.bashrc ]] && . ~/.bashrc

in ~/.bash_profile.

Obviously you may prefer a different set up.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2012-10-13 02:13:45

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: KDM not sourcing /etc/profile.d

@cfr, you know you can simply use

 [[ -f /etc/profile ]] && . /etc/profile 

instead of the if/then statement.  It will work either way, but I use the one liner because it makes my .xinitrc look a little cleaner.

Offline

#4 2012-10-13 22:56:56

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: KDM not sourcing /etc/profile.d

Yes. But I probably didn't when I originally wrote this. My config files have sort of migrated with me from machine to machine so there are bits which reflect what I now know (and don't know) and bits which reflect what I knew some time back (and didn't know). And then there are bits which I've half-updated, commented out etc. etc.

Your statement wouldn't be equivalent to what I have although I admit that that would not matter here.

Anyway, apparently the relevant bit of my .bash_profile is newer than the relevant bit of my .profile...

My config files are a mess which I am some day going to have to untangle... (I can't remember when I last used tcsh as an actual shell - as opposed to a script which still uses it - but my sh, bash and tcsh environments are still being automatically synced. This is from when Apple switched the default shell in OS X to bash.)

EDIT: actually .profile must just be older than .bash_profile as it is all written like this.

Last edited by cfr (2012-10-13 23:00:44)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2012-10-15 15:42:41

adrianbs
Member
From: Uruguay
Registered: 2009-08-13
Posts: 31

Re: KDM not sourcing /etc/profile.d

I think the problem is related with KDM. In previous installations /etc/profile sourced automatically

Offline

#6 2012-10-15 23:45:03

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: KDM not sourcing /etc/profile.d

It didn't source that automatically for me if I had e.g. ~/.profile at all. Maybe you've added a config file and that's causing the change in behaviour?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB