;
; $VER: Install InterTalk Pro V33.1 (19.04.93) UK Version
;

;------------------
; Reset complete %
;------------------
(complete 0)

;-------------------------
; Set our path variables.
;-------------------------
(set sourcepath "InterTalk:")
(set @default-dest "SYS:")

;-------------------------------------
; Variables to check for boot-device.
;-------------------------------------
(set sys-space (getdiskspace "SYS:"))
(set appname-space (getdiskspace (cat @app-name ":")))

;=============================================================================
;------------------
; English strings:
;------------------
(if (= @language "english")
(
(set default_lang 4)

(set #mustbootfromhd
(cat "\n\n\nError: You must boot from you hard drive to install " @app-name "."
))

(set #installaborted
(cat "Installation of " @app-name " aborted."
))

(set #askdestdir
(cat "In which drawer would you like to install " @app-name " ?"
))

(set #askdesthelp
(cat "You must choose the drawer where you will install " @app-name "."
     " A drawer by the name of " @app-name " will automatically be "
     "created below the drawer you choose here.\n\n" @askdir-help
))

(set #destdirexists
(cat "\n\n\n\n" @app-name " already exists. Should I abort the "
     "installation ?"
))

(set #destdirexistshelp
(cat "The " @app-name " drawer does already exist. You must choose if "
     "you want to install over the old version, or abort now, delete "
     "the old version, and then re-install " @app-name ". The "
     "recommended way is to delete the old version and then re-install."
))

(set #nowcopying1
(cat "Copying " @app-name " and related files to " @default-dest "..."
))

(set #nowcopying1help
(cat "This will copy " @app-name " and related files to the selected destination "
     "drawer.\n\n" @copyfiles-help
))

(set #nowcopying2
(cat "About to copy amigaguide.library..."
))

(set #nowcopying2help
(cat "This will copy amigaguide.library to your LIBS: drawer. " @app-name
     " requires this library in order to display amigaguide on-line help "
     "documents.\n\n" @copylib-help
))

(set #nowcopying3
(cat "Copying " @app-name " fonts to your FONTS: drawer."
))

(set #nowcopying3help
(cat "This will copy " @app-name " font to your FONTS: drawer. " @app-name
     " requires this font to operate correctly."
))

(set #nowcopying4
(cat "Copying " @app-name " keymaps to DEVS:KeyMaps."
))

(set #nowcopying4help
(cat "This will copy " @app-name " keymaps to your DEVS:KeyMaps drawer."
))

))

;=============================================================================

;---------
; Say HI!
;---------
(welcome)

;-----------------------
; Recognize OS version.
;-----------------------
(set osver (/ (getversion) 65535))

;---------------------------------
; User *HAS* to boot from his HD!
;---------------------------------
(if (= sys-space appname-space)
(
;-> User booted from disk. This is *NOT* allowed!
   (message #mustbootfromhd)
   (abort   #installaborted)
))

;--------------------------------
; Ask for destination directory.
;--------------------------------
(set @default-dest
   (askdir (prompt  #askdestdir)
           (help    #askdesthelp)
           (default @default-dest)
   )
)

(complete 10)

;-------------------------------------------------------
; Check that directory @app-name doesn't exist already.
;-------------------------------------------------------
(set @default-dest (tackon @default-dest @app-name))
(if (exists @default-dest)
   (if (askbool (prompt  #destdirexists)
                (help    #destdirexistshelp)
                (default 1)
       )
      (abort #installaborted)
   )
)

;---------------------------------------------
; Creating directories in destination drawer.
;---------------------------------------------
(makedir @default-dest (infos))

;------------------------
; Copying @app-name etc.
;------------------------
(copyfiles (prompt  #nowcopying1)
           (help    #nowcopying1help)
           (source  sourcepath)
           (dest    @default-dest)
           (choices "InterTalk" "InterTalk.info" "InterTalk.guide"
                    "InterTalk.guide.info" "InterTalk.cfg" "InterTalk.keys"
                    "InterTalk.Phone" "ReadmeFirst")
           (confirm "expert")
)

(complete 50)

;-----------------------------
; Copying amigaguide.library.
;-----------------------------
(copylib (prompt  #nowcopying2)
         (help    #nowcopying2help)
         (source  (tackon sourcepath "Libs/amigaguide.library"))
         (dest    "LIBS:")
         (optional)
         (confirm "average")
)

(complete 70)

;--------------------------
; Copying @app-name fonts.
;--------------------------
(copyfiles (prompt #nowcopying3)
           (help   #nowcopying3help)
           (source "InterTalk:Fonts")
           (dest   "FONTS:")
           (all)
           (confirm "expert")
)

(complete 80)

;----------------------------
; Copying @app-name keymaps.
;----------------------------
(copyfiles (prompt  #nowcopying4)
           (help    #nowcopying4help)
           (source  "InterTalk:Devs/KeyMaps")
           (dest    "DEVS:KeyMaps")
           (choices "ibmdk" "ibm" "dk")
           (confirm "expert")
)

(complete 100)

;------------------------------------------------------------------
; If something goes wrong the onerror below is called to clean-up.
;------------------------------------------------------------------
(onerror
   (delete @default-dest)
)

