;**************************************************
;
;$VER: SulliTech Lottery SelectorV2.0 (Sept.1998)
;
; Title:
;    SullotRNG Installer
; 
; Description:
;    The Commodore Installer Script for SullotRNG
;
; Installer script by Pete Sullivan
;
;**************************************************

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

(set SullotRNG_dir (getassign "SullotRNG"))
(set c_dir (getassign "C"))
(set libs_dir (getassign "LIBS"))
(set fonts_dir (getassign "FONTS"))
(set devs_dir (getassign "DEVS"))
(set s_dir (getassign "S"))
(set wbstartup_dir (getassign "SYS:WBSTARTUP"))

(set Src_root "")
(set Src_c "c/")
(set Src_s "s/")
(set Src_libs "libs/")
(set Src_devs "devs/")
(set Src_rexx "rexx/")
(set Src_DATA "DATA/")
(set Src_Sullitech "/")
(set Src_docs "Docs/")
(set Src_fonts "Fonts/")
(set Src_WBStartup "WBStartup/")
(set Src_AmiFTP "AmiFTP/")
(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  (<> SullotRNG_dir nothing)
     (if  (askbool
               (prompt "\n\n\nAn earlier version of PalomaFE already exists in"
               " your drawer named: \n\n"
               quote SullotRNG_dir quote
               "\n\nDo you want the update installed over it?")
               (help
               "\n\n\nThe installer has determined that you already have a "
               "some version of the SulliTech Random Number Generator 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 SullotRNG_dir
               (askdir
                    (prompt "Where would you like the updated software "
                    "installed?\n"
                    "The directory 'SullotRNG' will be created automatically.\n")
                    (help @askdir-help)
                    (default @default-dest)
               )
               )

               (set SullotRNG_dir
               (tackon SullotRNG_dir "SullotRNG")
               )

               (makedir SullotRNG_dir
               (infos)
               )
          )
     )
)

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

          (set SullotRNG_dir
          (tackon SullotRNG_dir "SullotRNG")
          )


          (makedir SullotRNG_dir
          (infos)
          )
     )
)

(set @default-dest SullotRNG_dir)















   
(complete 10)

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

(copyfiles
     (prompt "Select file(s) to be copied into your WBStartup: directory:")
     (help "\n\n\n\n\nThis will copy the Sullitech Random Number Generator to your WBStartup: "
     "directory.\n\n\n\n\n\n\n\n"
     @copyfiles-help)
     (source Src_root)
     (dest "SYS:WBStartup")
     (pattern "(Sullot|Sullot.info)")
     (confirm)
)
   
(complete 20)

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

;copy Cando.library

(copylib
   (source (tackon Src_libs "cando.library"))
   (dest "LIBS:")
   (prompt "Copying needed 'Cando.library' to LIBS:")
   (help @copylib-help)
   (confirm)
)

(complete 30)



; Copy SulliTech

(working omp "...Please Wait...")
   
(set SullotRNG_dir
     (copyfiles
          (prompt "These files will be copied to the SullotRNG: directory:")
          (help "\n\n\n\n\n\nThis will copy Sullot's main "
          "program.\n\n\n\n\n\n\n"
          @copyfiles-help)
          (source Src_root)
          (dest SullotRNG_dir)
          (pattern "(#?Sullot|Sullot.info|ReadMe#?)")
          (confirm)
)


)


(complete 40)

;create Documentation directory

(set Docs_dir
(cat SullotRNG_dir)
)
(set Docs_dir
(tackon Docs_dir "Docs")
)

(makedir Docs_dir
(infos)
)

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

(copyfiles
     (prompt "Select file(s) to be copied to the SullotRNG:Docs directory:")
     (help "\n\n\n\n\nThis will copy the documentation for "
     "Sullot.  This documentation should reside in your "
     "'SullotRNG:Docs' directory.\n\n\n\n\n\n"
     @copyfiles-help)
     (source Src_Docs)
     (dest Docs_dir)
     (pattern "#?.docs#?")
     (confirm)

)

(complete 50)



(exit)
