Final updates from Knowles.
[clearscm.git] / rc / set_path
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         $RCSfile: set_path,v $
5 # Revision:     $Revision: 1.8 $
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: 2012/09/20 18:10:28 $
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 [ "$SYSTEMROOT" ]; then
61   systemroot=$(cygpath -u $SYSTEMROOT)
62 fi
63
64 path_dirs="$path_dirs\
65   .\
66   "$HOME/bin"\
67   $adm_base/bin\
68   $adm_base/cc\
69   $adm_base/cq\
70   $adm_base/cvsbin\
71   /opt/Rational/Clearcase/bin\
72   /opt/Rational/ClearQuest\
73   /opt/Rational/Common\
74   /usr/local/mysql/bin\
75   /usr/local/maps/bin\
76   /usr/local/ddts/bin\
77   /usr/local/bin\
78   /usr/afsws/bin\
79   /usr/afsws\
80   /bin\
81   /sbin\
82   /usr/bin\
83   /usr/X11R6/bin\
84   /usr/bin/X11\
85   /usr/dt/bin\
86   /usr/openwin/bin\
87   /usr/kerberos/bin\
88   /opt/rational/clearcase/bin\
89   /opt/ibm/rationalsdlc/clearcase/bin\
90   /opt/ibm/rationalsdlc/clearcase/etc\
91   /opt/ibm/rationalsdlc/clearquest/bin\
92   /opt/ibm/rationalsdlc/clearquest\
93   /opt/ibm/rationalsdlc/common\
94   /usr/sbin\
95   /usr/ccs/bin\
96   /usr/seos/bin\
97   /usr/ucb\
98   /opt/ssh/bin\
99   /tools/bin\
100   $systemroot/System32\
101   $systemroot\
102 "  
103
104 manpath_dirs="\
105   /usr/share/man\
106   /usr/dt/man\
107   /usr/dt/man/man1\
108   /usr/cns/man\
109   /usr/local/packages/ccperl/ccperl5.001m/man\
110   /usr/local/packages/atria/current/man\
111   /usr/local/packages/emacs/man\
112   /usr/seos/man\
113   /opt/ssh/man\
114   /opt/medusa/share/man\
115   /usr/afsws/man\
116 "  
117
118 PATH=
119 for component in $path_dirs; do
120   append_to_path "$component"
121 done
122
123 # Set up MANPATH
124 if [ -f /etc/MANPATH ]; then
125   MANPATH=$(cat /etc/MANPATH)
126 fi
127
128 for component in $manpath_dirs; do
129   append_to_manpath "$component"
130 done
131
132 # Set up SHLIB_PATH
133 if [ "hp-ux" = "10" ]; then
134   export SHLIB_PATH=$(cat /etc/SHLIB_PATH)
135   export SHLIB_PATH=$SHLIB_PATH:$M_LROOT/bin
136   export LD_LIBRARY_PATH=$SHLIB_PATH:$M_LROOT/bin
137 fi
138