]> arthur.barton.de Git - ConfigScripts.git/blobdiff - sys/profile
Only update ~/.last_reminder when reminders have been shown
[ConfigScripts.git] / sys / profile
index acd3fa6a99d1488ad9e3436dfbaa9f5025f3a8b8..f6e5aeef36d935f418e18484bf15b96fb0b01a22 100644 (file)
@@ -11,14 +11,11 @@ export PROFILEREAD
 
 [ -e ~/.ConfigScripts.debug ] && echo " >> /etc/profile ..."
 
-# Source "~/.profile.user-1st", when available
-[ -r ~/.profile.user-1st ] && . ~/.profile.user-1st
-
 # 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=""
@@ -35,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
 
@@ -57,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
@@ -65,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
@@ -74,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
@@ -93,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"
@@ -117,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"
 
@@ -138,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)
@@ -161,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`
 
@@ -171,8 +197,8 @@ 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 ..."
-       if [ "$(type -t icalBuddy >/dev/null)" -a "$LOGNAME" != "root" ]; then
+       [ -e ~/.ConfigScripts.debug ] && echo "     - Reminders ..."
+       if [ "$(type -t icalBuddy 2>/dev/null)" -a "$LOGNAME" != "root" ]; then
                # icalBuddy(1)
                case "$LANG" in
                        *.UTF*) bul="•"; bul_imp="!"; sep="»"; ;;
@@ -186,15 +212,16 @@ if [ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]; then
                        eventsToday+1 2>/dev/null
                [ $? -eq 0 ] && echo
                unset bul bul_imp sep
+               [ -w ~/ ] && touch ~/.last_reminder
        else
                # remind(1)
-               if [ "$(type -t remind >/dev/null)" -a -r ~/.remind ]; then
+               if [ "$(type -t remind 2>/dev/null)" -a -r ~/.remind ]; then
                        remind -h -g -t5 ~/.remind | \
                                grep -v '^Reminders for ' | grep -v '^$'
                        [ $? -eq 0 ] && echo
                fi
+               [ -w ~/ ] && touch ~/.last_reminder
        fi
-       [ -w ~/ ] && touch ~/.last_reminder
 fi
 
 # bash-specific initialization