1 | #!/bin/sh |
---|
2 | |
---|
3 | #-------------------------------------------------- |
---|
4 | # main () |
---|
5 | #-------------------------------------------------- |
---|
6 | |
---|
7 | #-------------------------------------------------- |
---|
8 | # |
---|
9 | # First try to figure out where we are now. |
---|
10 | # |
---|
11 | #-------------------------------------------------- |
---|
12 | |
---|
13 | here=`pwd` #should be .../CMT/vxxx/mgr |
---|
14 | here=`dirname ${here}` #should be .../CMT/vxxx |
---|
15 | here=`dirname ${here}` #should be .../CMT |
---|
16 | here=`basename ${here}` #should be CMT |
---|
17 | |
---|
18 | if test ! "${here}" = "CMT" ; then # Are we outside of CMT ? |
---|
19 | echo " INSTALL should be run from within the mgr branch of the CMT package" |
---|
20 | echo " Please go there first and restart this script" |
---|
21 | echo " > cd <...>/CMT/v.../mgr" |
---|
22 | echo " > ./INSTALL" |
---|
23 | exit 1 |
---|
24 | fi |
---|
25 | |
---|
26 | p=`pwd` |
---|
27 | CMTROOT=`dirname $p` |
---|
28 | |
---|
29 | version=`basename ${CMTROOT}` |
---|
30 | p=`dirname ${CMTROOT}` |
---|
31 | ppath=`dirname ${p}` |
---|
32 | |
---|
33 | #-------------------------------------------------- |
---|
34 | # |
---|
35 | # On some sites, it is convenient to reformat the |
---|
36 | # dir. name obtained by pwd (eg. for removing the /tmp_mnt prefixes) |
---|
37 | # Some of these replacements are available in |
---|
38 | # the ${CMTROOT}/mgr/cmt_mount_filter file. |
---|
39 | # |
---|
40 | # You may add new substitutions in this file, according to your |
---|
41 | # specific file system configuration. |
---|
42 | # |
---|
43 | # Each entry takes the form : |
---|
44 | # |
---|
45 | #dir-name replacement-name |
---|
46 | # |
---|
47 | # (with space[s] as separator) |
---|
48 | # |
---|
49 | #-------------------------------------------------- |
---|
50 | |
---|
51 | if test -r cmt_mount_filter ; then |
---|
52 | e=`sed -e 's/[ ][ ]*/#/' \ |
---|
53 | -e 's/^[ ]*/s#/' \ |
---|
54 | -e 's/[ ]*$/#/' cmt_mount_filter` |
---|
55 | ppath=`echo ${ppath} | sed -e "$e"` |
---|
56 | fi |
---|
57 | |
---|
58 | #-------------------------------------------------- |
---|
59 | # |
---|
60 | # Building the setup.csh script |
---|
61 | # |
---|
62 | #-------------------------------------------------- |
---|
63 | |
---|
64 | cat <<END >setup.csh |
---|
65 | # echo "Setting CMT ${version} in ${ppath}" |
---|
66 | |
---|
67 | setenv CMTROOT ${ppath}/CMT/${version} |
---|
68 | |
---|
69 | END |
---|
70 | |
---|
71 | cat ../src/setup.csh >>setup.csh |
---|
72 | |
---|
73 | #-------------------------------------------------- |
---|
74 | # |
---|
75 | # Building the setup.sh script |
---|
76 | # |
---|
77 | #-------------------------------------------------- |
---|
78 | |
---|
79 | cat <<END >setup.sh |
---|
80 | # echo "Setting CMT ${version} in ${ppath}" |
---|
81 | |
---|
82 | CMTROOT=${ppath}/CMT/${version}; export CMTROOT |
---|
83 | |
---|
84 | END |
---|
85 | |
---|
86 | cat ../src/setup.sh >>setup.sh |
---|
87 | |
---|
88 | #-------------------------------------------------- |
---|
89 | # |
---|
90 | # Building the cleanup.csh script |
---|
91 | # |
---|
92 | #-------------------------------------------------- |
---|
93 | |
---|
94 | cp ../src/cleanup.csh ./cleanup.csh |
---|
95 | |
---|
96 | #-------------------------------------------------- |
---|
97 | # |
---|
98 | # Building the cleanup.sh script |
---|
99 | # |
---|
100 | #-------------------------------------------------- |
---|
101 | |
---|
102 | cp ../src/cleanup.sh ./cleanup.sh |
---|
103 | |
---|
104 | #-------------------------------------------------- |
---|
105 | # |
---|
106 | # In case one needs to re-build cmt from the sources |
---|
107 | # it's likely that cmt.exe does not exist yet thus |
---|
108 | # we cannot expect that dependencies are re-built. |
---|
109 | # |
---|
110 | # rather, we expect they have been downloaded from |
---|
111 | # the distribution kit and thus we just have to |
---|
112 | # touch them. |
---|
113 | # |
---|
114 | #-------------------------------------------------- |
---|
115 | |
---|
116 | touch ../src/*.make ../mgr/*.make ../mgr/cmt_path.make |
---|
117 | |
---|
118 | exes=`ls ../*/cmt.exe | sed -e 's#\.\./# #g' -e 's#/cmt.exe##g'` |
---|
119 | |
---|
120 | echo "============================================" |
---|
121 | echo " CMT installation terminated. " |
---|
122 | echo " -------------------- " |
---|
123 | if test "${exes}" = "" ; then |
---|
124 | echo " cmt.exe is not built on this site" |
---|
125 | echo " you might need to build it as follows:" |
---|
126 | echo " > source setup.csh" |
---|
127 | echo " > [g]make" |
---|
128 | else |
---|
129 | echo " cmt.exe is available on this site for:" |
---|
130 | echo "${exes}" |
---|
131 | fi |
---|
132 | echo "============================================" |
---|