Initial add of defaria.com
[clearscm.git] / defaria.com / GD / rc / set_path
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         $RCSfile: set_path,v $
5 # Revision:     $Revision: 1.4 $
6 # Description:  Sets the path from scratch
7 # Author:       Andrew@DeFaria.com
8 # Created:      Thu Jun  6 08:31:57 PDT 1996
9 # Modified:     $Date: 2006/10/30 05:24:03 $
10 # Language:     bash
11 #
12 # (c) Copyright 2000-2005, Andrew@DeFaria.com, all rights reserved.
13 #
14 ################################################################################
15 function append_to_path {
16   component="$1"
17   
18   if [ -d "$component" ]; then
19     if [ -z "$PATH" ]; then 
20       PATH="$component"
21     else
22       PATH="$PATH:$component"
23     fi
24   fi
25 } # append_to_path
26
27 function append_to_manpath {
28   component="$1"
29   
30   if [ -d "$component" ]; then
31     if [ -z "$MANPATH" ]; then 
32       MANPATH="$component"
33     else
34       MANPATH="$MANPATH:$component"
35     fi
36   fi
37 } # append_to_manpath
38
39 if [ -x /app/manpath ]; then
40   OLDIFS=$IFS
41   IFS=:
42   for manpath in $(/app/manpath); do
43     manpath_dirs="$manpath_dirs $manpath"
44   done
45   IFS=$OLDIFS
46 fi
47     
48 # Set up PATH
49 path_dirs=
50
51 if [ -f /etc/PATH ]; then
52   OLDIFS=$IFS
53   IFS=:
54   for path in $(cat /etc/PATH); do
55     path_dirs="$path_dirs $path"
56   done
57   IFS=$OLDIFS
58 fi
59
60 if [ -x cygpath ]; then
61   home=$(cygpath -u $(cygpath -pws /home/Andrew\ DeFaria) | tr [:upper:] [:lower:])
62 else
63   home=$HOME
64 fi
65
66 if [ "$SYSTEMROOT" ]; then
67   systemroot=$(cygpath -u $SYSTEMROOT)
68 fi
69
70 path_dirs="$path_dirs\
71   .\
72   "$home/bin"\
73   $home/adm/bin\
74   $home/adm/cc\
75   $home/adm/cq\
76   $home/adm/cvsbin\
77   $home/adm/hp\
78   /opt/Rational/Clearcase/bin\
79   /opt/Rational/ClearQuest\
80   /opt/Rational/Common\
81   $adm_base/bin\
82   $adm_base/clearcase\
83   /bin\
84   /usr/local/mysql/bin\
85   /usr/local/maps/bin\
86   /usr/afsws/bin\
87   /usr/afsws\
88   /usr/bin\
89   /usr/X11R6/bin\
90   /usr/bin/X11\
91   /usr/local/ddts/bin\
92   /usr/local/bin\
93   /usr/dt/bin\
94   /usr/openwin/bin\
95   /opt/rational/clearcase/bin\
96   /opt/rational/clearcase/etc\
97   /opt/rational/clearquest/bin\
98   /opt/rational/clearquest\
99   /usr/sbin\
100   /usr/ccs/bin\
101   /usr/seos/bin\
102   /usr/ucb\
103   /opt/ssh/bin\
104   /tools/bin\
105   $systemroot/System32\
106   $systemroot\
107 "  
108
109 manpath_dirs="\
110   /usr/share/man\
111   /usr/dt/man\
112   /usr/dt/man/man1\
113   /usr/eclipse/man\
114   /usr/atria/doc/man\
115   /usr/cns/man\
116   /usr/local/packages/ccperl/ccperl5.001m/man\
117   /usr/local/packages/atria/current/man\
118   /usr/local/packages/emacs/man\
119   /usr/seos/man\
120   /opt/ssh/man\
121   /opt/medusa/share/man\
122   /usr/afsws/man\
123 "  
124
125 PATH=
126 for component in $path_dirs; do
127   append_to_path "$component"
128 done
129
130 # Set up MANPATH
131 if [ -f /etc/MANPATH ]; then
132 MANPATH=$(cat /etc/MANPATH)
133 fi
134
135 for component in $manpath_dirs; do
136   append_to_manpath "$component"
137 done
138
139 # Set up SHLIB_PATH
140 if [ "hp-ux" = "10" ]; then
141   export SHLIB_PATH=$(cat /etc/SHLIB_PATH)
142   export SHLIB_PATH=$SHLIB_PATH:$M_LROOT/bin
143   export LD_LIBRARY_PATH=$SHLIB_PATH:$M_LROOT/bin
144 fi