home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / utility / misc / gulam / examples / install.g < prev    next >
Text File  |  1989-01-09  |  4KB  |  163 lines

  1. #
  2. # INSTALL
  3. #
  4. # This program helped me to settle on just what programs I wanted
  5. # in my AUTO folder.  Using this, I could quickly install several
  6. # programs, in a particular order, and experiment with the result.
  7.  
  8. # This GULAM program, "install.g", deletes every file in "A:\AUTO"
  9. # and the directory  "A:\AUTO"  itself.  It then re-creates the
  10. # directory "A:\AUTO" and copies the specified files into "A:\AUTO".
  11. # The order of programs in the directory matters, because the order
  12. # of the "prg" files in the file access tables determines order of
  13. # execution.  The order of copying into a new directory guarantees
  14. # the order of the files in the directory.  The RAMDISK must be first,
  15. # and if you start an ordinary GEM program such as one that you would
  16. # "click on from the desk", that must be last.
  17. #
  18. # The variable "fnl" is the File Name List to put into the AUTO folder:
  19.  
  20. set    fnl    "    etrnl2.prg    ramdisk.dat "    # must be first
  21. set    fnl    " $fnl    acache.prg "
  22. set    fnl    " $fnl    idle12.prg "
  23. set    fnl    " $fnl    autotime.prh "
  24. set    fnl    " $fnl    biclock.prh "
  25. set    fnl    " $fnl    autocopy.prg    autocopy.dat "
  26. set    fnl    " $fnl    startgem.prg    startgem.inf "    # The last .PRG
  27. set    fnl    " $fnl    install.g "        # Dont forget this file too.
  28.  
  29. echo Make sure all listed files are present.
  30. set OK 1
  31. foreach fName { $fnl }
  32.     if { -f $fName } then
  33.         # file found, no problem.
  34.     ef
  35.         echo Could not find the file $fName.
  36.         set OK 0
  37.     endif
  38. endfor
  39. unset fName
  40.  
  41. set magic 7890
  42. if { $OK == 1 }
  43.     # all well, proceed.
  44.     echo All files found, proceed.
  45. ef
  46.     echo One or more file is missing.
  47.     echo 'Enter the password (' $magic ') to proceed anyway.'
  48.     if { $< == $magic }
  49.         echo Right.  Proceed.
  50.     ef
  51.         echo This program stops.
  52.         unset magic
  53.         unset OK
  54.         unset fnl
  55.         exit
  56.     endif
  57. endif
  58.  
  59. set    target a:\auto
  60. if { -f $target } then
  61.     echo 'There is a problem:  There is a *FILE* called' $target.
  62.     echo This program stops.
  63.     unset target
  64.     unset OK
  65.     unset magic
  66.     unset fnl
  67.     exit
  68. endif    
  69.  
  70. echo "Make sure $target is gone."
  71. if { -d $target } then
  72.     echo 'This program will remove all the files in' $target.
  73.     if { 1 == $OK }
  74.         #
  75.     echo 'It will install those in' $cwd 'instead.'
  76.     set msg 'If you want this,'
  77.         #
  78.     ef
  79.         #
  80.     set msg 'Warning!  Some of the listed replacements are not'
  81.     echo $msg 'in this directory!.'
  82.     set msg 'If you want to proceed anyway,'
  83.         #
  84.     endif    
  85.  
  86.     echo $msg 'type the magic number (' $magic ') now:'
  87.     if { $< == $magic }
  88.         echo Right.  Proceed.
  89.     ef
  90.         echo This program stops.
  91.         unset fnl
  92.         unset OK
  93.         unset magic
  94.         unset target
  95.         unset msg
  96.         exit
  97.     endif
  98.  
  99.     echo pushd $target
  100.     pushd $target
  101.     echo Remove everything in $target
  102.     rm *            # remove the files in A:\AUTO
  103.     echo popd
  104.     popd
  105.     echo Remove the directory $target itself.
  106.     rmdir $target
  107. endif
  108. unset OK
  109. unset magic
  110.  
  111. echo Make the directory $target.
  112.  
  113. if { -d $target } then
  114.     echo 'There is a problem:'
  115.     echo 'We still have directory $target. This might be because:'
  116.     echo '        there is a sub directory, or'
  117.     echo '        the disk is write protected.'
  118.     echo This program stops.
  119.     unset target
  120.     unset msg
  121.     unset fnl
  122.     exit
  123. ef
  124.     # nothing
  125. endif
  126.  
  127. # create the directory
  128. mkdir $target
  129.  
  130. if { -d $target } then
  131.     # nothing
  132. ef
  133.     echo 'Disaster.  Unable to make directory' $target.
  134.     echo This program stops.
  135.     unset target
  136.     unset msg
  137.     unset fnl
  138.     exit
  139. endif
  140.  
  141. foreach fName { $fnl }
  142.     if { -e $fName } then
  143.         echo    cp +t $fName $target\$fName
  144.             cp +t $fName $target\$fName
  145.     ef
  146.         echo Could not find the file $fName.
  147.     endif
  148. endfor
  149. unset target
  150. unset fnl
  151.  
  152. echo ' '
  153. set fName startgem.inf
  154. if { -e $fName } then
  155.     echo     cp +t $fName a:\$fName
  156.         cp +t $fName a:\$fName
  157. endif    
  158. unset msg
  159. unset fName
  160.  
  161. echo Installation complete.
  162.  
  163.