]> arthur.barton.de Git - ConfigScripts.git/commitdiff
Only add optional paths to PATH if .not_in_path does not exist
authorAlexander Barton <alex@barton.de>
Sun, 6 Jan 2013 17:22:35 +0000 (18:22 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 6 Jan 2013 17:22:35 +0000 (18:22 +0100)
sys/profile

index 6849ee5b2eb58cdc2daff1126633d27f6642639e..67b6314e59994002ab8c197d18b1bee835c9196c 100644 (file)
@@ -49,24 +49,33 @@ fi
 # prepend optional directories to PATH ...
 path=""
 for d in /Developer/usr/bin /usr/pkg/bin /usr/ucb /usr/lib/ccache /opt/*/bin; do
-       [ -d "$d" -o -h "$d" ] && path="$path$d:"
+       if [ -d "$d" -o -h "$d" ]; then
+               [ -e "$d/.not_in_path" ] || path="$path$d:"
+       fi
 done
 [ -n "$path" ] && PATH="$path$PATH"
 if [ "$UID" -eq 0 ]; then
        path=""
        for d in /usr/pkg/sbin /opt/*/sbin; do
-               [ -d "$d" -o -h "$d" ] && path="$path$d:"
+               if [ -d "$d" -o -h "$d" ]; then
+                       [ -e "$d/.not_in_path" ] || path="$path$d:"
+               fi
        done
        [ -n "$path" ] && PATH="$path$PATH"
 fi
 # append optional directories to PATH ...
 for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do
-       [ -d "$d" -o -h "$d" ] && PATH="$PATH:$d"
+       if [ -d "$d" -o -h "$d" ]; then
+               [ -e "$d/.not_in_path" ] || PATH="$PATH:$d"
+       fi
 done
 # set PATH so it includes user's private executables
-[ -d ~/Applications ] && PATH=~/Applications:"${PATH}"
-[ -d ~/bin ] && PATH=~/bin:"${PATH}"
-[ -d ~/sbin ] && PATH=~/sbin:"${PATH}"
+[ -d ~/Applications -a ! -e ~/Applications/.not_in_path ] \
+       && PATH=~/Applications:"${PATH}"
+[ -d ~/bin -a ! -e ~/bin/.not_in_path ] \
+       && PATH=~/bin:"${PATH}"
+[ -d ~/sbin -a ! -e ~/sbin/.not_in_path ] \
+       && PATH=~/sbin:"${PATH}"
 
 # Setup MANPATH, if manpath(1) isn't available
 if [ ! "$(type manpath 2>/dev/null)" ]; then