;$VER:2.55 update
;installer script by Curt Esser
;last modified JAN 14 1999
;nah, it's not copyrighted  ©
;what could you do with it except install our program?

(complete 0)

;(set @default-dest "WORK:")

; Texts

(set #Intro-Txt
  (cat "\nWelcome to "
  "the BeatBox2 v2.55\n"
  "Update Script\n\n"
  "BeatBox2 is designed and programmed by:\n\n"
  "James L. Boyd\n"
  "and\n"
  "Curt Esser\n\n"
  "NOTE: You MUST have already installed BeatBox2 to use this update!"
))

(set #Locale-Txt
  (cat "Check the Locale file(s) you want to install "
       "in your SYS:Locale/ directory\n\n"
       "NOTE:  It is NOT necessary to do this.\n"
       "Please read the Help section first"
       ))

(set #Locale-Help
  (cat "This section will install the selected "
       "Locale catalogs into your SYS:Locale/ directory.\n\n"
       "NOTE:  If you have already installed the BeatBox2 "
       "catalogs in SYS:Locale/ you should install these "
       "new catalogs there too!  Otherwise you will "
       "have problems with the Locale texts\n\n"   
       "It is NOT necessary to do this if you do not "
       "already have earlier BeatBox2 catalogs in "
       "SYS:Locale/ \n\n"
       "BeatBox2 will access the Locale files "
       "from it's own directory, so there is really no need "
       "to clutter up your Locale directory unless you "
       "need to have them there for editing.\n\n"
       ))

(set #Warning-Txt
  (cat "Warning !\n\n\n"
  "ReqTools.library not found in SYS:Libs/\n\n\n"
  "You MUST install ReqTools.library before running BeatBox2!"
))

(set #CopyCat-Help
  (cat "You only need these if you are using "
       "a language other than English as your "
       "Preferred Locale, "
       "or if you use more than one Preferred Locale\n\n"
       "NOTE: these are NEW Locale files, and if you "
       "have installed the Locale files before, You "
       "should install these too, or you will have "
       "problems!"
))

(set #Path-Txt
  (cat "Where is your current BeatBox2 directory?\n ")
)


(set #Path-Help
  (cat "Please show me where your "
       "BeatBox2 directory is located\n"
       "Just select the directory where "
       "You see the BeatBox2 drawer\n\n"
       "Do NOT select the BeatBox2 "
       "drawer itself!\n\n"
       @askdir-help)
)



; Main ----------------------------

(message #Intro-Txt)

(IF (NOT (EXISTS "LIBS:reqtools.library"))
    (message #Warning-Txt (all))
)

(complete 10)

(set target         ; Where to install ? 
  (askdir 
    (prompt #Path-Txt) 
    (help #Path-Help) 
    (default @default-dest) 
    (newpath)
  )
)

(set @default-dest target)


(complete 25)

(if (= @user-level 2)

  (set #CatType       ;copy catalogs to Locale: ?
  
    (set Clog
      (askoptions
        (prompt #Locale-Txt) 
        (help #Locale-Help)
        (choices
           "English"               ;Bit $01
           "Français")             ;Bit $02 
        (default 0)
      )
    )
  )
)



(complete 30)

;we need to remove any old catalog files!

(IF (EXISTS (tackon target "BeatBox2/catalogs/english/Beatbox2.catalog"))
    (DELETE
     (tackon target "BeatBox2/catalogs/english/BeatBox2.catalog")
    )
)

(IF (EXISTS (tackon target "BeatBox2/catalogs/Français/BeatBox2.catalog"))
    (DELETE
    (tackon target "BeatBox2/catalogs/Français/BeatBox2.catalog")
   )
)    

(IF (EXISTS ( "SYS:Locale/catalogs/Français/BeatBox2.catalog"))
    (DELETE
     ("SYS:Locale/catalogs/Français/BeatBox2.catalog")
    )
)

(IF (EXISTS ( "SYS:Locale/catalogs/english/BeatBox2.catalog"))
    (DELETE
     ("SYS:Locale/catalogs/english/BeatBox2.catalog")
    )
)

(COMPLETE 40)


;---- Copy REQUIRED files ---

; - NO choice - these are all required

(copyfiles
  (prompt  "Copying BeatBox2")
  (source "BeatBox2")
  (dest (tackon target "BeatBox2"))
)

(copyfiles
  (prompt  "Copying BeatBox2.Prefs")
  (source "BeatBox2.Prefs")
  (dest (tackon target "BeatBox2"))
)


(complete 50)

(copyfiles
  (prompt  "Copying Docs")
  (source "Docs/")
  (all)
  (dest (tackon target "BeatBox2/Docs"))
)

(IF (NOT 
  (EXISTS (tackon target "BeatBox2/BeatBox2.key")
  ))
    (copyfiles 
      (source "BeatBox2.key")
      (dest (tackon target "BeatBox2/"))
    )
)



; -- Copy OPTIONAL Files --

(if (= Clog $00)   ;skip this if they sent 'em to LOCALE:
  (copyfiles
    (prompt  "Copying Locale Catalogs")
    (source "Catalogs/")
    (all)
    (dest (tackon target "BeatBox2/Catalogs"))
    (help #CopyCat-Help)
    (confirm)
  )
)

(complete 60)


; -- copy catalogs to Locale: if desired  

(if (bitand Clog $01)
    (copyfiles
      (prompt "Copying English Locale")
      (help @copyfiles-help)
      (source "catalogs/English")
      (dest "Locale:catalogs/English/")
      (confirm)
      (all)
    )
)

(complete 80)  

(if (bitand Clog $02)
    (copyfiles
      (prompt "Copying Français Locale")
      (help @copyfiles-help)
      (source "catalogs/Français")
      (dest "Locale:catalogs/Français")
      (confirm)
      (all)
    )
)  



(complete 100)

(exit "\n\nJames and Curt hope you enjoy BeatBox2\n\n" 
      "You will find BeatBox2 v2.55 in your\n\n"
      (target)" directory\n\n"
      "\n\nPlease read the docs!"
      (QUIET)

)
