X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/f24df2c0c211599e34c34b8018dec4712f7ece79..c537b3bfacb5ca65cc6c3c2b7919c1b3190bb3a0:/bash_profile diff --git a/bash_profile b/bash_profile index c95db15..08e4e13 100644 --- a/bash_profile +++ b/bash_profile @@ -1,5 +1,4 @@ -# -# $Id: .profile,v 1.3 1997/01/09 20:30:23 mdw Exp $ +# -*-sh-*- # # Bash startup things # @@ -8,6 +7,15 @@ if [ -z "$__mdw_profile" ]; then export __mdw_profile=done +# --- Work out my home directory --- +# +# This horrible trick resolves symbolic links. It enables resolving links, +# changes directory and displays the name of the directory in a subshell +# to avoid changing the current state. + +HOME=`(set -P; cd $HOME; pwd)` +cd $HOME + # --- Add elements to a path string --- __mdw_addto () { @@ -19,9 +27,9 @@ __mdw_addto () { [ -d $i ] || continue case "X$val" in X) - val=$i - continue - ;; + val=$i + continue + ;; X$i) continue ;; @@ -44,24 +52,26 @@ __mdw_addto () { export $var=$val } -# --- What sort of machine am I running on? --- - -export arch=`echo $MACHTYPE | tr 'A-Z' 'a-z'` - # --- Set the path variable --- __mdw_addto PATH l \ + $HOME/bin \ {,/usr{,/local}{,/X11R6}}{/bin,/sbin,/games} \ - $HOME{,/arch/{$arch,any-any-any}}/bin \ - /opt/nfast{/bin,/sbin} \ + /opt/nfast{,/gcc}{/bin,/sbin} \ $HOME/src/ncipher/scripts -export PLAN9=/usr/local/plan9 -__mdw_addto PATH r \ - $PLAN9/bin +if [ -d /usr/local/plan9 ]; then + export PLAN9=/usr/local/plan9 + __mdw_addto PATH r \ + $PLAN9/bin +fi + +# --- Find whether a program exists --- + +__mdw_programp () { type -t >/dev/null "$1"; } # --- And the same for manual pages --- -case "$arch" in +case "$MACHTIME" in *linux*) MANPATH=`manpath -q` ;; @@ -70,28 +80,31 @@ __mdw_addto MANPATH l \ {/usr{,/local}{,/X11R6}{,/share}}/{man,catman} \ $HOME/man -# --- Work out my home directory --- -# -# This horrible trick resolves symbolic links. It enables resolving links, -# changes directory and displays the name of the directory in a subshell -# to avoid changing the current state. - -HOME=`(set -P; cd $HOME; pwd)` -cd $HOME - # --- Where my mail comes from --- -export MAIL=$HOME/Mailbox +export MAIL=`mdw-conf mailbox` export NAME="Mark Wooding" -export EMAIL="mdw@distorted.org.uk" +export EMAIL=`mdw-conf email` export QMAILINJECT=c -# --- GIT environment things --- +# --- Find a text editor --- + +export MDW_EDITOR=ed +emacs_startup_args="--no-site-file --mdw-fast-startup -nw" +for ed in \ + "emacs22 $emacs_startup_args" \ + "emacs21 $emacs_startup_args" \ + zile mg \ + "emacs -nw" \ + vi pico nano ae; do + name=`echo $ed | sed 's/ .*$//'` + if __mdw_programp "$name"; then + MDW_EDITOR=$ed + break + fi +done -export GIT_AUTHOR_NAME=$NAME -export GIT_AUTHOR_EMAIL=$EMAIL -export GIT_COMMITTER_NAME=$NAME -export GIT_COMMITTER_EMAIL=$EMAIL +export EDITOR=mdw-editor VISUAL=mdw-editor # --- Various options for programs --- @@ -99,44 +112,77 @@ umask 002 [ -z "$HOST" ] && export HOST=`hostname` -export EDITOR="emacs -nw"; export VISUAL="$EDITOR" +if [ "$DISPLAY" != "" ]; then + LANG=`mdw-conf x-ctype` +else + : ${LANG=${LC_CTYPE-${LC_ALL-`mdw-conf console-ctype`}}} + case "$TERM,`tty`" in + linux,/dev/tty*) + if vt-is-UTF8 >/dev/null 2>&1; then + ctype=.utf8 + else + ctype= + fi + LANG=${LANG%.*}$ctype + ;; + esac +fi +unset LC_ALL +export LC_COLLATE=POSIX LANG + +__mdw_programp distcc && export CCACHE_PREFIX=distcc + export TEXINPUTS=".:$HOME/lib/tex//:" -__mdw_addto INFOPATH r $HOME/info /usr/info /usr/share/info /usr/local/info +__mdw_addto INFOPATH r \ + $HOME/info \ + /usr/info /usr/share/info \ + /usr/local/info /usr/local/share/info \ + /usr/local/share/info/its __mdw_addto PERLLIB r $HOME/lib/perl __mdw_addto PYTHONPATH r $HOME/lib/python -[ -z "$LS_OPTIONS" ] && export LS_OPTIONS="-F" +export __MDW_ROOTLY=`mdw-conf rootly` -export RMBKP="-abc +q -i" +[ -z "$LS_OPTIONS" ] && export LS_OPTIONS="-F" export BASCAT="-l +n" export CVS_RSH=ssh -case $HOST in - metalzone | metalzone.* ) - export CVSROOT="/home/cvs/cvs" - export SVNROOT="file:///home/cvs/svn" - ;; - *) - export CVSROOT="metalzone.distorted.org.uk:/home/cvs/cvs" - export SVNROOT="svn+ssh://metalzone.distorted.org.uk/home/cvs/svn" - ;; -esac +export CVSROOT=`mdw-conf cvs-root` +export SVNROOT=`mdw-conf svn-root` +export P4PORT=`mdw-conf p4-port` P4USER=`mdw-conf p4-user` + export BECOME="--preserve-environment" export PAGER=`type -p less` METAMAIL_PAGER=`type -p less` -export LESS="-iqgRh1" +export LESS="-iqgRh1FX" export LESSOPEN="|lesspipe.sh %s" -export LESSCHARSET=latin1 +case "${LC_CTYPE-$LANG}" in + *utf8 | *utf-8 | *UTF8 | *UTF-8) LESSCHARSET=utf-8 ;; + *) LESSCHARSET=latin1 ;; +esac +export LESSCHARSET +__mdw_programp global && export LESSGLOBALTAGS=global +export NCURSES_NO_UTF8_ACS=1 # export MAKEFLAGS="-j4" -[ "$TMPDIR"] || eval `tmpdir -b` +[ "$TMPDIR" ] || eval `tmpdir -b` export TMP=$TMPDIR export PERL_READLINE_NOWARN=yes -[ -z "$NNTPSERVER" ] && export NNTPSERVER=metalzone.distorted.org.uk -[ -z "$http_proxy" ] && export http_proxy="http://metalzone.distorted.org.uk:3128/" -[ -z "$ftp_proxy" ] && export ftp_proxy=$http_proxy +[ -z "$NNTPSERVER" ] && export NNTPSERVER=`mdw-conf nntp-server` + +http=`mdw-conf http-proxy none` +case "${http_proxy-none},$http" in + *,none) ;; + none,*) export http_proxy=http://$http/ ;; +esac +ftp=`mdw-conf ftp-proxy none` +case "${ftp_proxy-none},$ftp,${http_proxy-none}" in + *,none,none) ;; + none,none,*) export ftp_proxy=$http_proxy ;; + none,*,*) export ftp_proxy=http://$ftp/ ;; +esac export XUSERFILESEARCHPATH="$HOME/.Xapps/%N:/usr/lib/X11/%T/%N%S" @@ -155,7 +201,7 @@ eval `start-ssh-agent -b` if [ -z "$__mdw_bashrc" ] && [ "$__mdw_force_secure_session" = "yes" ] || ( tty="`tty`" devtty="(/dev/)?${tty#/dev/}" { { { [ -e /etc/securetty ] && sectty=/etc/securetty; } || - { [ -e /etc/securettys ] && sectty=/etc/securettys; }; } && + { [ -e /etc/securettys ] && sectty=/etc/securettys; }; } && egrep "$devtty" $sectty >/dev/null; } || { [ -e /etc/default/login ] && egrep "^CONSOLE=$devtty" /etc/default/login >/dev/null; } || @@ -182,6 +228,8 @@ if pixie --version >/dev/null 2>&1; then fi fi +[ -f "$HOME/.profile-local" ] && . "$HOME/.profile-local" + # --- Now, if my .bashrc hasn't been run yet, run it --- # # Oh, don't do that if we don't have a terminal.