
;/*     $VER: MC_Install 1.3 (06.07.97)      */
;/*                                          */
;/*  This script is part of MailCheck v1.3   */
;/*    and may not be modified or copied     */
;/*  without the authors written permission  */
;/*                                          */
;/*   ©1997 DCS Software by Robert Wilson    */

failat 25

if not exists c:requestchoice 
  echo "This installer requires C:RequestChoice"
  wait 2
  quit
endif

if not exists c:requestfile
  c:requestchoice >env:answer "Error" "This installer requires*nC:RequestFile!" "Sorry"
  wait 2
  quit
endif

if exists s:user-startup
  search s:user-startup ";BEGIN MailCheck" >nil:
  if not warn 
    c:requestchoice >env:answer "Error" "Existing installation found, please*nremove it and run this installer again!" "Sorry"
    quit
  endif
else
  c:requestchoice >env:answer "Error" "S:User-Startup not found!" "Hmmm"
  quit
endif

assign InstallerPath: "" >nil:
if $rc eq 20 
  c:requestchoice >env:answer "Fatal error" "This installer cannot handle spaces in path names!*nHopefully this will be fixed in the future...?" "Sorry :("
  quit
endif  

lab MIAMI

assign >nil: Miami: EXISTS
if warn 
  c:requestchoice >env:answer "MailCheck Version 1.3" "I cannot find an assign for Miami!*n*nShow me where it is..." "Okay"  
  c:requestfile >env:miamipath TITLE="Location of Miami" NOICONS DRAWERSONLY
  if $rc not eq 0
    skip ASKQUIT1
  else
    assign Miami: $miamipath >nil: 
    if $rc eq 20 
      c:requestchoice >env:answer "Fatal error" "This installer cannot handle spaces in path names!*nHopefully this will be fixed in the future...?" "Sorry :("
    quit
    endif  
  endif
else
  cd Miami:
  cd >env:miamipath
endif

lab MAILCHECK

cd Sys:

c:requestchoice >env:answer "MailCheck Version 1.3" "Please select destination directory for MailCheck*n*nIf not present, a directory will be created here." "Okay"  
c:requestfile >env:mcparent TITLE="Location of MailCheck" NOICONS DRAWERSONLY

if $rc not eq 0
  skip ASKQUIT2
else
  assign MailCheckParent: $mcparent >nil:
  if $rc eq 20 
    c:requestchoice >env:answer "Fatal error" "This installer cannot handle spaces in path names!*nHopefully this will be fixed in the future...?" "Sorry :("
  quit
  endif
  cd MailCheckParent:
endif

if not exists MailCheck
  makedir MailCheck
endif

cd MailCheck

if not exists C
  makedir C
endif

if not exists Docs
  makedir Docs
endif

cd >env:mailcheckpath

assign MailCheck: $mailcheckpath >nil:
if $rc eq 20 
  c:requestchoice >env:answer "Fatal error" "This installer cannot handle spaces in path names!*nHopefully this will be fixed in the future...?" "Sorry :("
  quit
endif  

copy InstallerPath:data/s/#?check s: quiet clone
copy InstallerPath:data/#? MailCheck: all quiet clone
copy InstallerPath:mailcheck.gui#? MailCheck:Docs quiet clone
copy InstallerPath:ReadMe#? MailCheck: quiet clone
copy c:wait MailCheck:C/ quiet clone
copy InstallerPath:MailCheckDirIcon MailCheckParent:MailCheck.info 
setenv MCStep 1

copy s:user-startup s:user-startup.old clone quiet
echo "" >> s:user-startup
echo ";BEGIN MailCheck" >> s:user-startup
echo assign Miami: $miamipath >> s:user-startup
echo assign MailCheck: $mailcheckpath >> s:user-startup
echo setenv MCStep 1 >> s:user-startup
echo ";END MailCheck" >> s:user-startup
echo "" >> s:user-startup

skip END

lab ASKQUIT1

c:requestchoice >env:answer "MailCheck Version 1.3" "Do you want to exit installation?" "Yes" "No"

if $answer eq "1"
  skip MESSAGE
else
  skip MIAMI back
endif


lab ASKQUIT2

c:requestchoice >env:answer "MailCheck Version 1.3" "Do you want to exit installation?" "Yes" "No"

if $answer eq "1"
  skip MESSAGE
else
  skip MAILCHECK back
endif

lab END

c:requestchoice >env:answer "MailCheck Version 1.3" "Installation complete!" "Thanks :)"

assign InstallerPath: dismount >nil:
assign MailCheckParent: dismount >nil:

quit

lab MESSAGE

c:requestchoice >env:answer "MailCheck Version 1.3" "So be it, never mind :(" "Bye!"

quit
