6 if [ -z "$__mdw_profile" ]; then
8 export __mdw_profile=done
10 # --- Work out my home directory ---
12 # This horrible trick resolves symbolic links. It enables resolving links,
13 # changes directory and displays the name of the directory in a subshell
14 # to avoid changing the current state.
16 HOME=`(set -P; cd $HOME; pwd)`
19 # --- Add elements to a path string ---
22 local var=$1 val dir=$2 new=""
26 case "$new:" in *:$i:*) continue;; esac
37 val=`echo $val | sed -e "s=:$i:=:="`
49 l) val=${new#:}:$val;;
55 # --- Set the path variable ---
59 {,/usr{,/local}{,/X11R6}}{/bin,/sbin,/games} \
60 /opt/nfast{,/gcc}{/bin,/sbin} \
61 $HOME/src/ncipher/scripts
62 if [ -d /usr/local/plan9 ]; then
63 export PLAN9=/usr/local/plan9
68 # --- Find whether a program exists ---
70 __mdw_programp () { type -t >/dev/null "$1"; }
72 # --- And the same for manual pages ---
79 __mdw_addto MANPATH l \
80 {/usr{,/local}{,/X11R6}{,/share}}/{man,catman} \
83 # --- Where my mail comes from ---
85 export MAIL=`mdw-conf mailbox`
86 export NAME="Mark Wooding"
87 export EMAIL=`mdw-conf email`
90 # --- Find a text editor ---
93 emacs_startup_args="--no-site-file --mdw-fast-startup -nw"
95 "emacs22 $emacs_startup_args" \
96 "emacs21 $emacs_startup_args" \
100 name=`echo $ed | sed 's/ .*$//'`
101 if __mdw_programp "$name"; then
107 export EDITOR=mdw-editor VISUAL=mdw-editor
109 # --- Various options for programs ---
113 [ -z "$HOST" ] && export HOST=`hostname`
115 if [ "$DISPLAY" != "" ]; then
116 LANG=`mdw-conf x-ctype`
118 : ${LANG=${LC_CTYPE-${LC_ALL-`mdw-conf console-ctype`}}}
121 if vt-is-UTF8 >/dev/null 2>&1; then
126 LANG=${LANG%.*}$ctype
131 export LC_COLLATE=POSIX LANG
133 __mdw_programp distcc && export CCACHE_PREFIX=distcc
135 export TEXINPUTS=".:$HOME/lib/tex//:"
137 __mdw_addto INFOPATH r \
139 /usr/info /usr/share/info \
140 /usr/local/info /usr/local/share/info \
141 /usr/local/share/info/its
142 __mdw_addto PERLLIB r $HOME/lib/perl
143 __mdw_addto PYTHONPATH r $HOME/lib/python
145 export __MDW_ROOTLY=`mdw-conf rootly`
147 [ -z "$LS_OPTIONS" ] && export LS_OPTIONS="-F"
149 export BASCAT="-l +n"
152 export CVSROOT=`mdw-conf cvs-root`
153 export SVNROOT=`mdw-conf svn-root`
154 export P4PORT=`mdw-conf p4-port` P4USER=`mdw-conf p4-user`
156 export BECOME="--preserve-environment"
158 export PAGER=`type -p less` METAMAIL_PAGER=`type -p less`
159 export LESS="-iqgRh1FX"
160 export LESSOPEN="|lesspipe.sh %s"
162 *utf8 | *utf-8 | *UTF8 | *UTF-8) LESSCHARSET=utf-8 ;;
163 *) LESSCHARSET=latin1 ;;
166 __mdw_programp global && export LESSGLOBALTAGS=global
167 export NCURSES_NO_UTF8_ACS=1
168 # export MAKEFLAGS="-j4"
169 [ "$TMPDIR" ] || eval `tmpdir -b`
171 export PERL_READLINE_NOWARN=yes
173 [ -z "$NNTPSERVER" ] && export NNTPSERVER=`mdw-conf nntp-server`
175 http=`mdw-conf http-proxy none`
176 case "${http_proxy-none},$http" in
178 none,*) export http_proxy=http://$http/ ;;
180 ftp=`mdw-conf ftp-proxy none`
181 case "${ftp_proxy-none},$ftp,${http_proxy-none}" in
183 none,none,*) export ftp_proxy=$http_proxy ;;
184 none,*,*) export ftp_proxy=http://$ftp/ ;;
187 export XUSERFILESEARCHPATH="$HOME/.Xapps/%N:/usr/lib/X11/%T/%N%S"
189 export PS_PERSONALITY=gnu
191 export NC_SITES=cam:bos
193 # -- Disable core dumps ---
197 # --- Start an ssh authentication agent ---
199 eval `start-ssh-agent -b`
201 if [ -z "$__mdw_bashrc" ] && [ "$__mdw_force_secure_session" = "yes" ] ||
202 ( tty="`tty`" devtty="(/dev/)?${tty#/dev/}"
203 { { { [ -e /etc/securetty ] && sectty=/etc/securetty; } ||
204 { [ -e /etc/securettys ] && sectty=/etc/securettys; }; } &&
205 egrep "$devtty" $sectty >/dev/null; } ||
206 { [ -e /etc/default/login ] &&
207 egrep "^CONSOLE=$devtty" /etc/default/login >/dev/null; } ||
208 case "${tty#/dev/}" in
209 console|systty|tty[0-9]) true ;;
213 export __mdw_sechost="`hostname`"
216 [ -n "$DT" ] && trap "source $HOME/.bash_logout" EXIT
218 # --- And a passphrase pixie ---
220 if pixie --version >/dev/null 2>&1; then
221 mkdir -p $HOME/.catacomb
222 pixie=${CATACOMB_PIXIE-$HOME/.catacomb/pixie}
223 if [ -S "$pixie" ] && pixie -C help >/dev/null 2>/dev/null; then
226 pixie -d 2>>$HOME/.catacomb/pixie.log
227 __mdw_started_pixie=yes
231 [ -f "$HOME/.profile-local" ] && . "$HOME/.profile-local"
233 # --- Now, if my .bashrc hasn't been run yet, run it ---
235 # Oh, don't do that if we don't have a terminal.
237 [ -z "$__mdw_bashrc" ] && [ -t 0 ] && \
238 [ -r $HOME/.bashrc ] && . $HOME/.bashrc