.key skip/k,dest
.bra {
.ket }
.def dest xyzzy
;
; HDInstall2
; Startup File for City Desk 2.0, Hard Drive Instalation
; Copying All files takes a minimum of 4000 blocks free on Hard drive 
; or 2,048,000 bytes (approx. 2.00mg)
;
;

data2:CDBat/skip {skip$Startup}           ; used to debug

lab Startup
   Data2:cdbat/Assign  OldFrom{$$}: ""    ; "" = the current directory
   data2:cdbat/cd data2:cdbat             ; force use of AmigaDOS v1.3 commands
   echo "*Ec*NPlease wait while I make sure everything is OK..." NOLINE
failat 21

lab CheckCopy
; check to see if copy is aliased as "COPY [] CLONE" or "COPY [] ALL" or both
   copy testdir to ram:temp{$$} QUIET
   if error
      echo "*N*N The COPY command is not responding properly to the QUIET parameter*N"
      type 'CopyWarning.txt      ; Copy Did not work right, Read HDInstall.readme
      ask -dy "Press Return..."
      Skip ExitQuick
   else
      copy testdir to ram:temp{$$} CLONE QUIET
         if error
            echo "*N*N The COPY command is not responding properly to the CLONE parameter*N"
            type 'CopyWarning.txt         ; Copy Did not work right, Read HDInstall.readme
            ask -dy "Press Return..."
            Skip ExitQuick
         else
            copy testdir to ram:temp{$$} ALL CLONE QUIET
            if error
               echo "*N*N The COPY command is not responding properly to the ALL parameter*N"
               type 'CopyWarning.txt               ; Copy Did not work right, Read HDInstall.readme
               ask -dy "Press Return..."
               Skip ExitQuick
            endif
         endif
      delete ram:temp{$$}
   endif

lab Copy2Ram
; See if they want to copy installation files to RAM:
   type data2:cdbat/'Copy2Ram.txt
   ask -dy " Copy Installation files to RAM:? Y"
   if warn
      cd data2:CDBAT
      skip CheckENV
   else
      echo "*EcMoving needed files to Ram:..." NOLINE
      Copy Data2:CDBat to RAM:CDBat ALL CLONE QUIET
      RAM:CDBat/cd RAM:CDBat
      Copy data2:HDInstall2 to ram:CDBat CLONE QUIET
   endif
      assign CDBat: ""                    ; "" = the current directory

lab CheckENV
; Make Sure that ENV: exists
   assign >nil: env: exists               ; Check for ENV:
      if warn                             ; No ENV:
         makedir ram:env                  ; Make it
         assign env: ram:env              ; Assign it
      endif

lab CheckARP
; **************** Don't forget to check for ARP.library ******************
   execute .CopyArpLibrary.bat

lab CheckDest 
; Check to see if they have supplied a valid {dest}
   Execute .CheckDest.bat dest {dest}

lab MainMenu
   Execute .MainMenu.bat {dest}



lab ExitQuick                             ; We got here because of a problem
   echo "*N*NExiting HDInstall..." NOLINE
   delete env:choice{$$}
   echo "*N"
;   ask -dy "*N Shall I close this CLI window when I am finished? Y"
   if warn 
      cd OldFrom{$$}:                        ; goto where we were
      Data2:cdbat/Assign  OldFrom{$$}:
      quit
   else
      cd OldFrom{$$}:                        ; goto where we were
      Data2:cdbat/Assign  OldFrom{$$}:
      Data2:cdbat/endcli
   endif
