]> arthur.barton.de Git - ConfigScripts.git/blobdiff - sys/profile
Let tset(1) fix up TERM, don't do it "manually"
[ConfigScripts.git] / sys / profile
index 207bf5baf2134451e606fec6158fa0e02b60b2a8..7088872198ad466e49b3620c6ee472b60779d656 100644 (file)
@@ -1,7 +1,7 @@
 #
 # /etc/profile: system-wide profile for the Bourne shell (sh(1)) and
 # Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
-# Written 2003-2014 by Alexander Barton (alex@barton.de)
+# Written 2003-2015 by Alexander Barton (alex@barton.de)
 #
 
 [ -e ~/.ConfigScripts.debug ] && echo " .. /etc/profile ..."
@@ -13,9 +13,9 @@ export PROFILEREAD
 
 # Setup locale and encoding
 if [ -e ~/.ConfigScripts.debug ]; then
-       echo " - TERM=\"$TERM\""
-       echo " - LANG=\"$LANG\""
-       echo " - LC_CTYPE=\"$LC_CTYPE\""
+       echo "     - TERM=\"$TERM\""
+       echo "     - LANG=\"$LANG\""
+       echo "     - LC_CTYPE=\"$LC_CTYPE\""
 fi
 # Does LC_CTYPE or LANG indicate an UTF-8 terminal?
 LC_encoding=""
@@ -32,11 +32,11 @@ if [ -z "$LC_encoding" ]; then
                        LC_encoding="ISO8859-1"
        esac
 fi
-[ -e ~/.ConfigScripts.debug ] && echo " - LC_encoding=\"$LC_encoding\" (temp)"
+[ -e ~/.ConfigScripts.debug ] && echo "     - LC_encoding=\"$LC_encoding\" (temp)"
 # Set locale if it is not set or doesn't contain a dot:
 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
        && export LANG="${LANG:-de_DE}.${LC_encoding}"
-[ -e ~/.ConfigScripts.debug ] && echo " - LANG=\"$LANG\" (new)"
+[ -e ~/.ConfigScripts.debug ] && echo "     - LANG=\"$LANG\" (new)"
 # Clean up ...
 unset LC_CTYPE LC_encoding 2>/dev/null
 
@@ -54,7 +54,14 @@ else
 fi
 # prepend optional directories to PATH ...
 unset path
-for d in /Developer/usr/bin /usr/pkg/bin /usr/ucb /usr/lib/ccache /opt/*/bin; do
+for d in \
+  /usr/local/opt/ccache/libexec \
+  /Developer/usr/bin \
+  /usr/pkg/bin \
+  /usr/ucb \
+  /usr/lib/ccache \
+  /opt/*/bin
+do
        if [ -d "$d" -o -h "$d" ]; then
                [ -e "$d/.not_in_path" ] || path="$path$d:"
        fi
@@ -62,7 +69,10 @@ done
 [ -n "$path" ] && PATH="$path$PATH"
 unset path
 if [ "$LOGNAME" = "root" ]; then
-       for d in /usr/pkg/sbin /opt/*/sbin; do
+       for d in \
+         /usr/pkg/sbin \
+         /opt/*/sbin
+       do
                if [ -d "$d" -o -h "$d" ]; then
                        [ -e "$d/.not_in_path" ] || path="$path$d:"
                fi
@@ -71,7 +81,11 @@ if [ "$LOGNAME" = "root" ]; then
        unset path
 fi
 # append optional directories to PATH ...
-for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do
+for d in \
+  /usr/bin/X11 \
+  /usr/games \
+  /usr/share/php/bin
+do
        if [ -d "$d" -o -h "$d" ]; then
                [ -e "$d/.not_in_path" ] || PATH="$PATH:$d"
        fi
@@ -90,7 +104,12 @@ if [ ! "$(type -t manpath 2>/dev/null)" ]; then
        [ -z "$MANPATH" ] \
                && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
        path=""
-       for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
+       for d in \
+         /usr/pkg/share/man \
+         /usr/pkg/man \
+         /opt/*/share/man \
+         /opt/*/man
+       do
                [ -d "$d" -o -h "$d" ] && path="$path$d:"
        done
        [ -n "$path" ] && MANPATH="$path$MANPATH"
@@ -114,6 +133,9 @@ export HOSTNAME
        && export LOCAL_HOME="/usr/local/home/$LOGNAME" \
        || export LOCAL_HOME="$HOME"
 
+# Source "~/.profile.user-1st", when available
+[ -r ~/.profile.user-1st ] && . ~/.profile.user-1st
+
 # Setup environment to use local storage (no NFS, if possible!)
 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
 
@@ -135,7 +157,10 @@ fi
 
 # read profile additions
 if [ -d /etc/profile.d -o -d /usr/local/etc/profile.d ]; then
-       for f in /etc/profile.d/* /usr/local/etc/profile.d/*; do
+       for f in \
+         /etc/profile.d/* \
+         /usr/local/etc/profile.d/*
+       do
                [ -r "$f" ] || continue
                case "$f" in
                        *.csh)
@@ -158,6 +183,10 @@ case "$-" in
        *) return ;;
 esac
 
+# Use "xterm-256color" for xterm's (and the like) when it is available
+[ "$TERM" = "xterm" -a -r "/usr/share/terminfo/x/xterm+256color" ] \
+       && export TERM="xterm-256color"
+
 # validate terminal definition
 type -t tset >/dev/null && eval `tset -s -Q`
 
@@ -168,7 +197,7 @@ type -t tset >/dev/null && eval `tset -s -Q`
 
 # Reminders (once every 60 minutes)
 if [ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]; then
-       [ -e ~/.ConfigScripts.debug ] && echo " - Reminders ..."
+       [ -e ~/.ConfigScripts.debug ] && echo "     - Reminders ..."
        if [ "$(type -t icalBuddy >/dev/null)" -a "$LOGNAME" != "root" ]; then
                # icalBuddy(1)
                case "$LANG" in