Setting default user environments in /etc/profile.d/
Stroller wrote:
> What am I doing wrong or misunderstanding, please?
Rename your file to "essential_defaults.sh". Only files with a ".sh"
extension are sourced (assuming you are using bash).
-- Remy
05-01-2012, 06:27 PM
Michael Orlitzky
Setting default user environments in /etc/profile.d/
On 05/01/2012 02:11 PM, Stroller wrote:
> So /etc/profile contains the following message:
>
> # You should override these in your ~/.bashrc (or equivalent) for per-user
> # settings. For system defaults, you can add a new file in /etc/profile.d/.
> export EDITOR=${EDITOR:-/bin/nano}
> export PAGER=${PAGER:-/usr/bin/less}
>
> Therefore I have created a plain text file /etc/profile.d/essential_defaults
>
First of all, use `eselect pager` =)
The reason this isn't working is that the comment at the top of
/etc/profile fails to mention this:
for sh in /etc/profile.d/*.sh ; do
[ -r "$sh" ] && . "$sh"
done
unset sh
So it looks like you need to add a ".sh" extension.
05-01-2012, 06:38 PM
Alex Schuster
Setting default user environments in /etc/profile.d/
Stroller writes:
> Therefore I have created a plain text
> file /etc/profile.d/essential_defaults
[...]
> Yet when I log in, these environment variables are not set.
>
> The file is world-readable (mode 644), and I even tried setting the
> execute bit (`chmod +xxx`).
It needs to be readable by your user, more is not needed.
> If I source the file using `. /etc/profile.d/essential_defaults` then
> suddenly I get the right pager, but it does not seem to be sourced at
> login, as I believe is promised. What am I doing wrong or
> misunderstanding, please?
/etc/profile is sourced for login shells only. That happens when you log
in a text console, but usually not for a graphical terminal. As a KDE
user, I have set my Konsole's profiles to run '/bin/bash -l', this gives
me login shells. For xterm or aterm, you would use the '-ls' option.
Wonko
05-01-2012, 07:40 PM
Stroller
Setting default user environments in /etc/profile.d/
On 1 May 2012, at 19:27, Michael Orlitzky wrote:
> On 05/01/2012 02:11 PM, Stroller wrote:
>> So /etc/profile contains the following message:
>>
>> # You should override these in your ~/.bashrc (or equivalent) for per-user
>> # settings. For system defaults, you can add a new file in /etc/profile.d/.
>> export EDITOR=${EDITOR:-/bin/nano}
>> export PAGER=${PAGER:-/usr/bin/less}
>>
>> Therefore I have created a plain text file /etc/profile.d/essential_defaults
>>
>
> First of all, use `eselect pager` =)
Actually, if you look at the contents of my essential_defaults file, I'm not so interested in the pager as the MANPAGER setting. I find that after using `most` as my man-pager, it's quite horrible using `less` on a new system. For anything else, `less` is fine.
Stroller.
05-01-2012, 07:41 PM
Stroller
Setting default user environments in /etc/profile.d/
On 1 May 2012, at 19:20, Remy Blank wrote:
> Stroller wrote:
>> What am I doing wrong or misunderstanding, please?
>
> Rename your file to "essential_defaults.sh". Only files with a ".sh"
> extension are sourced (assuming you are using bash).
Many thanks!
That's it.
Stroller.
05-01-2012, 07:42 PM
Stroller
Setting default user environments in /etc/profile.d/
On 1 May 2012, at 19:38, Alex Schuster wrote:
>> …
>> The file is world-readable (mode 644), and I even tried setting the
>> execute bit (`chmod +xxx`).
>
> It needs to be readable by your user, more is not needed.
Yeah, I thought not, but I thought I'd mention trying it.
Stroller.
05-01-2012, 10:52 PM
"Walter Dnes"
Setting default user environments in /etc/profile.d/
On Tue, May 01, 2012 at 07:11:37PM +0100, Stroller wrote
> So /etc/profile contains the following message:
>
> # You should override these in your ~/.bashrc (or equivalent) for per-user
> # settings. For system defaults, you can add a new file in /etc/profile.d/.
> export EDITOR=${EDITOR:-/bin/nano}
> export PAGER=${PAGER:-/usr/bin/less}
>
> Therefore I have created a plain text file /etc/profile.d/essential_defaults
I don't know if it gets executed in the right order. Are you using
baselayout 2? The items you mentioned are EDITOR and PAGER. For the
official way of changing global settings, see...
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=5&style=printable
for examples. In my case...
In your case, I would suggest creating a file called /etc/env.d/99pager
containing the line...
PAGER="/usr/bin/most"
Note that the files are sourced by name in your current locale sort
order. In just about every locale numbers should sort properly, which
would start at 00blahblahblah and go through 99blahblahblah.
--
Walter Dnes <waltdnes@waltdnes.org>
05-02-2012, 02:26 AM
Pandu Poluan
Setting default user environments in /etc/profile.d/
On May 2, 2012 2:48 AM, "Stroller" <stroller@stellar.eclipse.co.uk> wrote:
>
>
> On 1 May 2012, at 19:27, Michael Orlitzky wrote:
>
> > On 05/01/2012 02:11 PM, Stroller wrote:
> >> So /etc/profile contains the following message:
> >>
> >> # You should override these in your ~/.bashrc (or equivalent) for per-user
> >> # settings. *For system defaults, you can add a new file in /etc/profile.d/.
> >> export EDITOR=${EDITOR:-/bin/nano}
> >> export PAGER=${PAGER:-/usr/bin/less}
> >>
> >> Therefore I have created a plain text file /etc/profile.d/essential_defaults
> >>
> >
> > First of all, use `eselect pager` =)
>
> Actually, if you look at the contents of my essential_defaults file, I'm not so interested in the pager as the MANPAGER setting. I find that after using `most` as my man-pager, it's quite horrible using `less` on a new system. For anything else, `less` is fine.
>
> Stroller.
>
>
'most' is for sissies ; I use vimmanpager for MANPAGER, and vimpager for PAGER.* ;-)
Rgds,
05-02-2012, 03:58 AM
Stroller
Setting default user environments in /etc/profile.d/
On 1 May 2012, at 23:52, Walter Dnes wrote:
> On Tue, May 01, 2012 at 07:11:37PM +0100, Stroller wrote
>> So /etc/profile contains the following message:
>>
>> # You should override these in your ~/.bashrc (or equivalent) for per-user
>> # settings. For system defaults, you can add a new file in /etc/profile.d/.
>> export EDITOR=${EDITOR:-/bin/nano}
>> export PAGER=${PAGER:-/usr/bin/less}
>>
>> Therefore I have created a plain text file /etc/profile.d/essential_defaults
>
> … The items you mentioned are EDITOR and PAGER. For the
> official way of changing global settings, see...
> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=5&style=printable
> for examples. In my case…
Nope, those are merely the next two lines from the file when I ran `grep -C X` to find where I'd read about putting files in /etc/profile.d/.
If you read my original post (solved) now, you'll see that in my actual my_defaults.sh file I only concern myself with the MANPAGER, the history file and vi-style line editing (for Bash).
Sorry if this was unclear,
Stroller.
05-02-2012, 04:01 AM
Stroller
Setting default user environments in /etc/profile.d/
On 2 May 2012, at 03:26, Pandu Poluan wrote:
>> Actually, if you look at the contents of my essential_defaults file, I'm not so interested in the pager as the MANPAGER setting. I find that after using `most` as my man-pager, it's quite horrible using `less` on a new system. For anything else, `less` is fine.
>
> 'most' is for sissies ; I use vimmanpager for MANPAGER, and vimpager for PAGER. ;-)
Hmmmn… I use vim as my editor, but most is much better for manpages. Perhaps it is simply the default syntax colouring that is so much better. I have tried your suggestion, and couldn't get along with it.