From: Duncan <1i5t5.duncan@cox.net>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] Re: /etc/profile.d/
Date: Sun, 17 Jul 2005 04:35:08 -0700 [thread overview]
Message-ID: <pan.2005.07.17.11.35.08.220986@cox.net> (raw)
In-Reply-To: 9f90e8bf050716181320b06312@mail.gmail.com
Herbert Fischer posted <9f90e8bf050716181320b06312@mail.gmail.com>,
excerpted below, on Sat, 16 Jul 2005 22:13:19 -0300:
> All scripts created by Gentoo emerges have some header signature (sort of
> cvs information), am I right?
>
> If so, some sort of checking script can detect Gentoo signed files on
> /etc/profile.d and just ignore them when scanning profile.d for user
> scripts.
[Just picked a post in the thread to reply to...]
Here's the solution I use here.
1. My /etc/profile, as well as all user ~/.bashrc files (that is, my
personal user, and root, and I'd setup skel for it too, if my system was a
multiple human user system), consist almost /entirely/ of one single
conditional execution. Note that I do *NOT* use the standard Gentoo
/etc/profile or /etc/bash/bashrc scripts.
# Source global definitions
if [ -f /etc/jedbashrc ]; then
. /etc/jedbashrc
fi
The jed is my initials. The idea is a namespace pollution guard -- I
don't have to worry about some package installing /etc/jedbashrc (and if
some package ever does, that's what portage's CONFIG_PROTECT is there for
=8^).
2. cat /etc/jedbashrc
# REMINDER: This is sourced by all bash shells on startup,
# including some such as scp and rcp that can't tolerate any output.
for i in /etc/profile.d/*; do
if [ $i = ${i%\~} -a $i = ${i%.bak} -a $i = ${i#.} -a $i = ${i%.csh} ]; then
. $i
fi
done
This runs all the scripts in /etc/profile.d EXCEPT backup files (*.back
and *~), hidden files (.*), and the csh scripts (*.csh). That's the
ENTIRE jedbashrc.
3. ls -1 /etc/profile.d
000profile.env.jed.sh
000user.jed.sh
010path.jed.sh
alias.jed.sh
bash-completion*
bash-hist.jed.sh
buildflags.jed.sh
editor.jed.sh
inputrc.jed.sh
noclobber.jed.sh
prompt.jed.sh
umask.jed.sh
xprint.sh*
bash-completion and xprint.sh, the portage installed scripts get executed
along with the others. Again with the namespace pollution prevention
thing -- the other scripts are mine and clearly marked as such.
Most of these substitute for functionality in the Gentoo default
/etc/profile and ~/.bashrc files, but many of them are customized for my
own purposes. (Among other things, I setup my path so the
/usr/local/(s)bin versions come first, thus making it dead simply to
substitute my own commands or wrapper scripts for Gentoo system defaults.)
Each task is modularized into its own file, the easier to maintain.
The 0xx scripts must be done first, as the others use stuff they setup.
The 000user script sets up $USER, used by 010path, which in turn allows
the other scripts to invoke commands without the absolute path. Other
than that, there's no specific order needed, so the straight names suffice.
...
The only hassle I have with this system, is that every time Gentoo updates
bash, I have to scan the new /etc/bash/bashrc and /etc/profile files, to
see if there's any serious changes in functionality I need to match with
new /etc/profile.d modules, or changes to existing modules. However,
that's really only the same sort of thing a responsible sysadmin is always
doing, with updates to /etc, regardless of the package. Because my
config is all non-default files, I don't have to worry about them being
overwritten. The worst that could happen would be that my non-default
/etc/profile, simply a hook into my own config, would be overwritten by
the default. That's simple enough to fix, if so, because there's only the
single (tested) command in my version, easy enough to create from scratch
if I fat-finger things and overwrite it.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman in
http://www.linuxdevcenter.com/pub/a/linux/2004/12/22/rms_interview.html
--
gentoo-dev@gentoo.org mailing list
next prev parent reply other threads:[~2005-07-17 11:38 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-15 21:59 [gentoo-dev] /etc/profile.d/ Herbert Fischer
2005-07-15 22:11 ` Mike Frysinger
2005-07-15 22:36 ` Herbert Fischer
2005-07-15 22:41 ` Mike Frysinger
2005-07-15 22:56 ` Herbert Fischer
2005-07-15 23:02 ` Mike Frysinger
2005-07-15 23:40 ` Herbert Fischer
2005-07-16 1:25 ` Michael Marineau
2005-07-16 1:34 ` Mike Frysinger
2005-07-16 1:56 ` Michael Marineau
2005-07-16 2:03 ` Mike Frysinger
2005-07-16 3:03 ` Donnie Berkholz
2005-07-16 17:03 ` Marius Mauch
2005-07-16 17:37 ` Herbert Fischer
2005-07-16 18:08 ` Herbert Fischer
2005-07-16 18:24 ` Herbert Fischer
2005-07-17 0:21 ` Mike Frysinger
2005-07-16 20:58 ` Martin Schlemmer
2005-07-17 0:23 ` Mike Frysinger
2005-07-17 0:22 ` Mike Frysinger
2005-07-17 2:38 ` Marius Mauch
2005-07-17 2:48 ` Mike Frysinger
2005-07-18 6:53 ` Donnie Berkholz
2005-07-18 13:00 ` Mike Frysinger
2005-07-18 23:47 ` Donnie Berkholz
2005-07-19 0:00 ` Mike Frysinger
2005-07-19 0:10 ` Donnie Berkholz
2005-07-20 19:27 ` Herbert Fischer
2005-07-20 21:05 ` Mike Frysinger
2005-07-20 22:46 ` Herbert Fischer
2005-07-20 22:52 ` Mike Frysinger
2005-07-20 23:26 ` Herbert Fischer
2005-07-16 16:51 ` Herbert Fischer
2005-07-16 3:16 ` Aaron Walker
2005-07-17 0:24 ` Mike Frysinger
2005-07-17 1:13 ` Herbert Fischer
2005-07-17 1:18 ` Mike Frysinger
2005-07-17 11:35 ` Duncan [this message]
2005-07-16 10:40 ` Martin Schlemmer
2005-07-16 5:46 ` Petteri Räty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pan.2005.07.17.11.35.08.220986@cox.net \
--to=1i5t5.duncan@cox.net \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox