Gentoo Archives: gentoo-dev

From: Herbert Fischer <herbert.fischer@×××××.com>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] /etc/profile.d/
Date: Fri, 15 Jul 2005 22:03:35
Message-Id: 9f90e8bf05071514597043b7bb@mail.gmail.com
1 Hi,
2
3 I'm new to this list and I really don't know if this is the right
4 place to post this message. I already posted something about this on
5 the gentoo forums and I don't know too if the correct persons are
6 seeing that, so I decided to post here. Sorry for the double posting,
7 so I'll be straight on the fact.
8
9 In about one and a half year working with Gentoo I had a lots os
10 yeepies and some boring problems.
11
12 I love the /etc/env.d, env-update, /etc/profile.env thing but I think
13 that is something missing.
14
15 In the past I worked many years with Slackware. Now I replaced
16 Slackware with Gentoo and everywere I use Gentoo, even on some old
17 creepy IBM-PPC B50 hardware.
18
19 In Slackware I had /etc/profile.d/ as a place to customize all my
20 shell environment, including aliases, prompt, etc, without touching
21 original Slackware's files.
22
23 In Gentoo we need to "hack" files that sometimes are changed in some
24 "emerge world" updates, like /etc/profile, /etc/skel/.bashrc, and that
25 is a little mess to me, as when etc-update's list is too long I place
26 a "-5" (auto update) and voilá... all my customizations are gone.
27
28 I suggest Gentoo adopting a /etc/profile.d/ dir like Slackware, or
29 even better, have some way, some place, to customize aliases, prompts,
30 etc, without being replaced on "etc-update"s... some place untouchable
31 for Gentoo, by Gentoo and that's automatically parsed on /etc/profile
32 (or somewhere else) by default.
33
34 Slackware parses /etc/profile.d/ by having those lines bellow on /etc/profile:
35
36 # Append any additional sh scripts found in /etc/profile.d/:
37 for file in /etc/profile.d/*.sh ; do
38 if [ -x $file ]; then
39 . $file
40 fi
41 done
42
43 ... and those lines in /etc/csh.login (for csh users):
44
45 # Append any additional csh scripts found in /etc/profile.d/:
46 [ -d /etc/profile.d ]
47 if ($status == 0) then
48 set nonomatch
49 foreach file ( /etc/profile.d/*.csh )
50 [ -x $file ]
51 if ($status == 0) then
52 source $file
53 endif
54 end
55 unset file nonomatch
56 endif
57
58 That way the root user only need to create new files on
59 /etc/profile.d/ to customize their shells. *.sh for bash/ash/sh and
60 *.csh for csh/tcsh shells.
61
62 Best regards,
63
64 Herbert G. Fischer
65
66 --
67 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] /etc/profile.d/ Mike Frysinger <vapier@g.o>
Re: [gentoo-dev] /etc/profile.d/ "Petteri Räty" <petteri.raty@××××××××××.fi>