[2] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | #-------------------------------------------------- |
---|
| 4 | # main () |
---|
| 5 | #-------------------------------------------------- |
---|
| 6 | |
---|
| 7 | #-------------------------------------------------- |
---|
| 8 | # |
---|
| 9 | # First try to figure out where we are now. |
---|
| 10 | # |
---|
| 11 | #-------------------------------------------------- |
---|
| 12 | |
---|
[5] | 13 | ##set -v |
---|
[2] | 14 | |
---|
| 15 | here=`pwd` #should be .../CMT/vxxx/mgr |
---|
| 16 | here=`dirname ${here}` #should be .../CMT/vxxx |
---|
| 17 | here=`dirname ${here}` #should be .../CMT |
---|
| 18 | here=`basename ${here}` #should be CMT |
---|
| 19 | |
---|
| 20 | if test ! "${here}" = "CMT" ; then # Are we outside of CMT ? |
---|
| 21 | echo " INSTALL should be run from within the mgr branch of the CMT package" |
---|
| 22 | echo " Please go there first and restart this script" |
---|
| 23 | echo " > cd <...>/CMT/v.../mgr" |
---|
| 24 | echo " > ./INSTALL" |
---|
| 25 | exit 1 |
---|
| 26 | fi |
---|
| 27 | |
---|
| 28 | p=`pwd` |
---|
| 29 | CMTROOT=`dirname $p` |
---|
| 30 | |
---|
| 31 | version=`basename ${CMTROOT}` |
---|
| 32 | p=`dirname ${CMTROOT}` |
---|
| 33 | ppath=`dirname ${p}` |
---|
| 34 | |
---|
| 35 | #-------------------------------------------------- |
---|
| 36 | # |
---|
| 37 | # On some sites, it is convenient to reformat the |
---|
| 38 | # dir. name obtained by pwd (eg. for removing the /tmp_mnt prefixes) |
---|
| 39 | # Some of these replacements are available in |
---|
| 40 | # the ${CMTROOT}/mgr/cmt_mount_filter file. |
---|
| 41 | # |
---|
| 42 | # You may add new substitutions in this file, according to your |
---|
| 43 | # specific file system configuration. |
---|
| 44 | # |
---|
| 45 | # Each entry takes the form : |
---|
| 46 | # |
---|
| 47 | #dir-name replacement-name |
---|
| 48 | # |
---|
| 49 | # (with space[s] as separator) |
---|
| 50 | # |
---|
| 51 | #-------------------------------------------------- |
---|
| 52 | |
---|
| 53 | if test -r cmt_mount_filter ; then |
---|
| 54 | e=`sed -e 's/[ ][ ]*/#/' -e 's/^[ ]*/s#/' -e 's/[ ]*$/#/' -e 's/^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 "============================================" |
---|