home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / devel / modula_2 / ipdm2s_i < prev    next >
Encoding:
Text File  |  1994-05-20  |  5.8 KB  |  254 lines

  1. #!/bin/csh -f
  2. #
  3. # Installs Modula-2* tree
  4. #
  5. # Syntax:  ipdm2s-install <VERSION> [<DIRECTORY> [<ARCH>]]
  6. #
  7. # Parameters:     1) Version number
  8. #        2) Target directory for Modula-2*    (default: './')
  9. #        3) required architecture        (default: determined)
  10. #
  11. # Stefan Haenssgen & Thomas Gauweiler  7-Apr-94
  12. #
  13. # Changes:
  14. #
  15. # 15-jan-93    Created                    [SH&TG]
  16. # 28-jan-93    .mspath file added            [TG]
  17. # 16-jun-93    /tmp_mnt eliminated            [TG]
  18. # 15-nov-93    architecture and others            [TG]
  19. # 11-jan-94    version stamp                [TG]
  20. # 01-apr-94    changed to ipd-version            [TG]
  21. # 02-may-94    uses ipdm2s.$VERSION.$ARCH.gz file, too    [TG]
  22. #
  23.  
  24. set MM_SED='sed -e s|/amd/|/|g -e s|/export/|/|g -e s|/tmp_mnt/|/|g'
  25.  
  26. #
  27. # determine machine architecture (what type of machine we're on!)
  28. # by examining return values of "uname", "arch", or "machine"
  29. #
  30.  
  31. if (-x /bin/uname || -x /usr/bin/uname) then
  32.     set SRC_ARCH=`uname -m`
  33. else if (-x /bin/arch || -x /usr/bin/arch) then
  34.     set SRC_ARCH=`arch`
  35. else if (-x /bin/machine || -x /usr/bin/machine) then
  36.     set SRC_ARCH=`machine`
  37. endif
  38.  
  39. if (! $?SRC_ARCH) then            # could architecture not be determined ?
  40.     echo 'Error: could not determine source architecture'
  41. #    exit 2
  42. else if ("$SRC_ARCH" =~ sun4*) then    # SparcStation
  43.     set SRC_ARCH="SUN4"
  44. else if ("$SRC_ARCH" =~ sun3*) then    # Sun-3 with 680x0 CPU
  45.     set SRC_ARCH="SUN3"
  46. else if ("$SRC_ARCH" =~ i?86*) then    # 386/486/Pentium PC
  47.     set SRC_ARCH="I386"
  48.     if (-x /bin/uname || -x /usr/bin/uname) then
  49.         if ("`uname -s`" =~ *Linux*) then
  50.             set SRC_ARCH="LINX"         # Linux
  51.         endif
  52.     endif
  53. else if ("$SRC_ARCH" =~ ksr?*) then    # KSR-1 or KSR-2
  54.     set SRC_ARCH="KSRP"
  55. else if ("$SRC_ARCH" =~ RISC* || "$SRC_ARCH" =~ mips*) then
  56.     if ("`uname -v`" =~ *MP*) then    # MasPar frontend if ..
  57.         set SRC_ARCH="MASP"           # DECStation and version *MP*
  58.     else
  59.         set SRC_ARCH="MIPS"        # else plain DECStation
  60.     endif
  61. else
  62.     echo 'Error: unknown source architecture "'$SRC_ARCH'"'
  63.     exit 9
  64. endif
  65.  
  66. #
  67. # check for parameters
  68. #
  69. if ($1 == "") then
  70.     echo 'usage:    ipdm2s-install <VERSION> [<DIRECTORY> [<ARCH>]]'
  71.     echo ''
  72.     echo '          default <DIRECTORY> is ./'
  73.     echo '          default <ARCH> is automagically determined'
  74.     echo ''
  75.     echo 'example:  ipdm2s-install 9401 ./ SUN4'
  76.     exit 1
  77. else
  78.     set VERSION=$1
  79. endif
  80. if ($2 == "") then
  81.     set MSDIR="./"
  82.     set ARCH=$SRC_ARCH
  83. else
  84.     set MSDIR=$2
  85. endif
  86. if ($3 == "") then
  87.     set ARCH=$SRC_ARCH
  88. else
  89.     set ARCH=$3
  90. endif
  91.  
  92. #
  93. # check if source & target exist and are accessible
  94. #
  95. if ( ! -r ipdm2s.$VERSION.$ARCH.tgz ) then
  96.     if ( -r ipdm2s.$VERSION.$ARCH.gz ) then
  97.         mv ipdm2s.$VERSION.$ARCH.gz ipdm2s.$VERSION.$ARCH.tgz
  98.     else if ( -r ipdm2s.$VERSION.$ARCH.tar.gz ) then
  99.         mv ipdm2s.$VERSION.$ARCH.tar.gz ipdm2s.$VERSION.$ARCH.tgz
  100.     else
  101.         echo 'Error: cannot access file "ipdm2s.'$VERSION.$ARCH'.tgz"'
  102.         exit 2
  103.     endif
  104. endif
  105. if ( ! -d $MSDIR) then
  106.     echo 'Error: target directory must already exist.'
  107.     exit 3
  108. endif
  109. if ( ! -w $MSDIR) then
  110.     echo 'Error: cannot write to target directory.'
  111.     exit 4
  112. endif
  113.  
  114. #
  115. # determine the paths
  116. #
  117.  
  118. set PWD_DIR=`pwd`
  119. cd $MSDIR
  120. set MSDIR=`pwd | $MM_SED`
  121.  
  122. #
  123. # extract it
  124. #
  125.  
  126. echo ''
  127. echo '*****'
  128. echo '*****  IPD Modula-2* Installation Script'
  129. echo '*****'
  130. echo ''
  131. echo 'Extracting from "'ipdm2s.$VERSION.$ARCH.tgz'" to "'$MSDIR'"'
  132. echo ''
  133. gunzip < $PWD_DIR/ipdm2s.$VERSION.$ARCH.tgz | tar xvf -
  134. echo ''
  135.  
  136. echo 'Installation directory = "'$MSDIR'"'
  137. echo $MSDIR/lib >.mspath
  138. echo ''
  139.  
  140. echo "Configuring the Modula-2* driver scripts ..."
  141. sed  -e "s|_MSC_HOME_|$MSDIR|"            \
  142.      <gen/driver.gen >bin/mm
  143.  
  144. #
  145. # make scripts and binaries executable
  146. #
  147.  
  148. chmod ugo+x bin/$ARCH/*.$ARCH
  149. chmod ugo+x bin/mm
  150. chmod ugo+x bin/liball
  151. chmod ugo+x bin/msproj
  152. chmod ugo+x bin/newarch
  153.  
  154. echo "Creating several symbolic links ..."
  155. cd bin
  156. if (-e mmclean) then
  157.   rm -f mmclean
  158.   rm -f msdel
  159.   rm -f msmake
  160.   rm -f msrun
  161.   rm -f msrm
  162.   rm -f xmsp
  163. endif
  164. ln -s mm mmclean
  165. ln -s mm msdel
  166. ln -s mm msmake
  167. ln -s mm msrun
  168. ln -s mm msrm
  169. ln -s mm xmsp
  170. cd ..
  171.  
  172. #
  173. # create example project directory
  174. #
  175.  
  176. echo 'Creating example project directory ...'
  177. cd examples
  178. ../bin/msproj $ARCH
  179. cd ..
  180. echo ''
  181.  
  182. #
  183. # create the documentation
  184. #
  185.  
  186. if ( ! -r $PWD_DIR/ipdm2s.doc.tar ) then
  187.   echo 'Information: no documentation archive found ...'
  188. else
  189.   echo 'Extracting compressed documents from documentation archive ...'
  190.   echo ''
  191.   tar xvf $PWD_DIR/ipdm2s.doc.tar
  192.   cd doc
  193.   echo ''
  194.   echo 'Uncompressing the IPD Modula-2* manual ...'
  195.   gunzip ipdm2s.manual.gz
  196.   cd ..
  197. endif
  198.  
  199. #
  200. # change write permissions of extracted & generated files
  201. #
  202.  
  203. echo 'Changing write permissions of extracted files and directories ...'
  204. chmod    go-w .mspath Xmsp architectures
  205. chmod -R go-w bin/ doc/ emacs/ examples/ gen/ lib/
  206. echo ''
  207.  
  208. #
  209. # registration
  210. #
  211.  
  212. echo 'Do you want to register your installation now (y/n) ?'
  213. set answer=$<
  214. if ( "$answer" =~ y* || "$answer" =~ Y* ) then
  215.   if ( ! -d doc) then
  216.     mkdir doc
  217.   endif
  218.  
  219.   echo 'Please enter your complete email address: '
  220.   set email=$<
  221.   set date=`date`
  222.   sed  -e "s|_USER_|$USER|" -e "s|_EMAIL_|$email|"    \
  223.        -e "s|_VER_|$VERSION|" -e "s|_ARCH_|$ARCH|"    \
  224.        -e "s|_DATE_|$date|" -e "s|_ARCH_|$ARCH|"    \
  225.      <gen/registration.gen >doc/registration
  226.   chmod go-w doc/registration
  227.  
  228.   echo ''
  229.   cat doc/registration
  230.   echo 'Do you really want to send this message (y/n) ?'
  231.   set sendanswer=$<
  232.   if ( "$sendanswer" =~ y* || "$sendanswer" =~ Y* ) then
  233.     echo ''
  234.     if (-x /usr/lib/sendmail) then
  235.       /usr/lib/sendmail -t <doc/registration
  236.       echo 'Okay, registration mail sent.'
  237.     else if (-x `which mail`) then
  238.       mail ipdm2s@ira.uka.de <doc/registration
  239.       echo 'Okay, registration mail sent.'
  240.     else
  241.       echo 'Sorry, could not find "sendmail" or "mail" programs.'
  242.     endif
  243.   endif
  244. endif
  245. echo ''
  246.  
  247. #
  248. # return
  249. #
  250.  
  251. echo 'Please add "'$MSDIR/bin'" to your PATH variable.'
  252. cd $PWD_DIR
  253. echo ''
  254.