;**************************************************
;
;$VER: iFUSION v1.0 (15/03/01)
;
; Title:
;    iFUSION's Software Installer
; 
; Description:
;    The Commodore Installer Script for iFUSION
;
;
;**************************************************

(set true 1)
(set false 0)
(set quote "\"")
(set nothing "")
(set WB2 (< 2293760 (getversion "exec.library" (resident)))) ; true if under 2.0

(set iFUSION_dir (getassign "iFUSION"))
(set libs_dir (getassign "LIBS"))

(set Src_root "")
(set Src_libs "INSTALL/libs/")
(set Src_main "INSTALL/")
(set Src_docs "INSTALL/Documentation/")
(set Src_ROMS "INSTALL/ROM/")
(set Src_drivers "INSTALL/Drivers/")
(set Temp_dir "ram:t/")

(set MSG_CopyDevs1 "\n\nCopying needed device ")
(set MSG_CopyDevs2 " to DEVS:")

; start with not updated software!

(set is_update false)

(if  (<> iFUSION_dir nothing)
     (if  (askbool
               (prompt "\n\n\nA version of iFUSION already exists in"
               " your drawer named: \n\n"
               quote iFUSION_dir quote
               "\n\nDo you want the update installed over it?")
               (help
               "\n\n\nThe installer has determined that you already have a "
               "version of the iFusion emulation software installed "
               "on your system.  If this is wrong or you want the update "
               "installed elsewhere, select 'NO', otherwise select 'YES'."
               )
               (default 1)
          )
               (set is_update true) 

;else ask where to put software

               (
               (set iFUSION_dir
               (askdir
                    (prompt "Where would you like the updated software "
                    "installed?\n"
                    "The directory 'iFUSION' will be created automatically.\n")
                    (help @askdir-help)
                    (default @default-dest)
               )
               )

               (set iFUSION_dir
               (tackon iFUSION_dir "iFUSION")
               )

               (makedir iFUSION_dir
               (infos)
               )
          )
     )
)

; FUSION: was not previously assigned, so ask where to make it
(if  (= iFUSION_dir nothing)
          (
          (set iFUSION_dir
               (askdir
                    (prompt "Where would you like the software installed?\n"
                    "The directory 'iFUSION' will be created automatically.\n")
                    (help @askdir-help)
                    (default @default-dest)
               )
          )

          (set iFUSION_dir
          (tackon iFUSION_dir "iFUSION")
          )


          (makedir iFUSION_dir
          (infos)
          )
     )
)

(set @default-dest iFUSION_dir)

(complete 5)

(working omp "...Please Wait...")

(copyfiles
     (prompt "Select file(s) to be copied into your Libs: directory:")
     (help "\n\n\n\n\nThis will copy powerpc.library and warp.library to your Libs: "
     "directory.\n\n\n\n\n\n\n\n"
     @copyfiles-help)
     (source Src_libs)
     (dest libs_dir)
     (pattern "#?")
     (confirm)
)
   
(complete 10)

(working omp "...Please Wait...")

;create ROM directory
(set ROM_dir
(cat iFUSION_dir)
)
(set ROM_dir
(tackon ROM_dir "ROM")
)

(makedir ROM_dir
;(infos)
)
   

(complete 40)

; Copy iFUSION emulation

(working omp "...Please Wait...")
   
(set iFUSION_dir
     (copyfiles
          (prompt "Select files to be copied to the iFUSION: directory:")
          (help "\n\n\n\n\n\nThis will copy the MAC emulation's main "
          "programs.\n\n\n\n\n\n\n"
          @copyfiles-help)
          (source Src_main)
          (dest iFUSION_dir)
          (pattern "(#?FUSION#?)")
          (confirm)
     )
)


;copy Config-Vars

(complete 50)

(copyfiles
          (prompt "Select files to be copied to the iFUSION: directory:")
          (help "\n\n\n\n\n\nThis will copy the Mac emulation config "
          "file.\n\n\n\n\n\n\n"
          @copyfiles-help)
          (source Src_main)
          (dest iFUSION_dir)
          (pattern "(config-vars)")
          (confirm)
     )

(complete 55)

;create Drivers directory
   
(set drivers_dir
(cat iFUSION_dir)
)
(set drivers_dir
(tackon drivers_dir "Drivers")
)

(makedir drivers_dir
;(infos)
)


(working omp "...Please Wait...")

(copyfiles
     (prompt "Select file(s) to be copied into your Drivers directory:")
     (help "\n\n\n\n\nThis will copy the drivers to the proper "
     "directory.  ALL MAC drivers must reside in your "
     "'iFUSION:Drivers' directory.\n\n\n\n\n\n"
     @copyfiles-help)
     (source Src_drivers)
     (dest drivers_dir)
     (pattern "(#?)")
     (confirm)
)

(complete 60)


(complete 70)

;create Documentation directory

(set Docs_dir
(cat iFUSION_dir)
)
(set Docs_dir
(tackon Docs_dir "Documentation")
)

(makedir Docs_dir
(infos)
)

(working omp "...Please Wait...")

(copyfiles
     (prompt "Select file(s) to be copied Documentation directory:")
     (help "\n\n\n\nThis will copy the AmigaGuide documentation for "
     "iFUSION.  ALL emulation documentation should reside in your "
     "'iFUSION:Documenation' directory.\n\n\n\n\n\n"
     @copyfiles-help)
     (source Src_docs)
     (dest Docs_dir)
     (pattern "#?")
     (confirm)
)





(complete 100)

(exit)
