You are not logged in.

#1 2005-03-19 23:38:56

mbahamonde
Member
From: Germantown, MD
Registered: 2005-02-11
Posts: 15

/etc/profile.d scripts

Hi,
I would like to know when are profile.d scripts called, and how to make a custom application use them.
For example, there's a kde.sh script which sets some environment variables, I would like to do the same, but for a custom version of KDE that i compiled (KDE CVS HEAD), which happens to be at /opt/kdecvs/.
Now my question is how and when will it be called a custom script i made and put on /etc/profile.d/kdecvs.sh.

Thanks a lot in advance.

Offline

#2 2005-03-19 23:46:32

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: /etc/profile.d scripts

the /etc/profile.d scripts are called from /etc/profile, which is called from any shell which is a login shell.

Offline

#3 2005-03-20 00:00:50

mbahamonde
Member
From: Germantown, MD
Registered: 2005-02-11
Posts: 15

Re: /etc/profile.d scripts

phrakture wrote:

the /etc/profile.d scripts are called from /etc/profile, which is called from any shell which is a login shell.

Hi,
And how do i tell an application to use a certain profile script?

Greetings.

Offline

#4 2005-03-20 00:38:46

Eugenia
Member
From: Bay Area, CA, USA
Registered: 2005-03-08
Posts: 74
Website

Re: /etc/profile.d scripts

I am not sure what you mean "tell an application", but if that helps, you can do this: "source /etc/profile.d/myprofile.sh" before the app is loaded.

Offline

#5 2005-03-20 00:46:31

mbahamonde
Member
From: Germantown, MD
Registered: 2005-02-11
Posts: 15

Re: /etc/profile.d scripts

Eugenia wrote:

I am not sure what you mean "tell an application", but if that helps, you can do this: "source /etc/profile.d/myprofile.sh" before the app is loaded.

Hi!
Sorry, I think I didn't make myself clear. What you say, probably will work, I will try it later.

I'm wondering now how does arch's KDE packages do this... I was looking at kdm sessions, and the entry that loads kde, does call /opt/kde/bin/startkde directly, without doing the source /etc/profile.d/profile.sh before...
Is there any other "cleaner" way?

Thanks in advance.

Offline

#6 2005-03-20 00:52:28

puntmuts
Member
Registered: 2005-02-22
Posts: 138

Re: /etc/profile.d scripts

These scripts are executed at user login. See /etc/profile .


Out / Gone
Mirgrating all my machines off ArchLinux . No longer part of the ArchLinux community / users .
Done. Goodbye.

Offline

#7 2005-03-20 18:31:21

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: /etc/profile.d scripts

Why are you concerned about this?  The /etc/profile script sources every file in the profile.d directory.  This *only* happens when you are logged in from a login terminal... In the case of kdm/gdm/xdm and other things like that, you *never* login to a terminal, and therefore, they do not get executed....

Offline

#8 2005-03-21 00:27:10

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: /etc/profile.d scripts

phrakture wrote:

In the case of kdm/gdm/xdm and other things like that, you *never* login to a terminal, and therefore, they do not get executed....

They don't? I don't think so (at least with KDM).
Why did most people have problems with menu-items in KDE some time ago? Answer: bad XDG variables (which are loaded in a profile.d script).
Not to mention the ~80 env variables shown on tab-completion in a Konsole. Most of them are most likely loaded from the profile.d files.

For the first post:
Do a script to initialize your variables and start your KDE-CVS. The content of the variables will replace already set variables. Don't put the script in profile.d because it will be automatically started and you'll get weird results (since the files are processed in no particular order - I think). As I said, make a script to set up env variables and start your KDE.

Restoring should be done on a simple re-login (or rerun the original kde.sh in profile.d).

Offline

Board footer

Powered by FluxBB