; Installer Script for SimpleFTP (AmigaOS 3.5)
; $VER: SimpleFTP-Install v1.4 (7.5.00) (OS3.5)

(effect "lower_left" "horizontal" $000000 $000000)
(set #logo "Install-Logo.gif")
(set #register "Install-Register.gif")
(set #thanks "Install-Thanks.gif")

(set #ask-email
(cat "Please enter your e-mail address, this is needed for\n"
     "logging into servers that require anonymous access."
))

(set #install-docs
(cat "Install documentation?\n"
))

(set #select-lang
(cat "Select language:"
))

(set #not-installed
(cat "\nSimpleFTP has NOT been installed.\n"
))

(set #goodbye
(cat "\nInstallation of SimpleFTP is complete.\n\n"
     "Don't forget to configure it before you use it!"
))

(set #select-dir
(cat "Please select somewhere to install SimpleFTP\n"
     "(A directory is NOT created for you)"
))

(set #my-address
(cat "\nContact Information\n\n"
     "Author: Rick Hodger\n"
     "e-Mail: rick@thehub.u-net.com\n"
     "Bugs: bugs@thehub.u-net.com\n"
     "Web: http://www.thehub.u-net.com\n"
))

(set #copyright
(cat "\nSimpleFTP is (C) Copyright 1999-2000 Rick Hodger\n"
     "Written by Rick Hodger\n\n"
     "The author in no way offers any guarantees or warranties "
     "with this program.  By continuing this installation, "
     "you agree that the author is in no way responsable "
     "for any damage caused.\n\n"
     "Do you agree to these terms?"
))

(set #not-enough-space
(cat "\nSorry, you do not have enough space on this drive\n"
     "to install SimpleFTP.  The installation requires 290kb\n"
     "of free space."
))

(set #ask-install-default-mime
(cat "\nDo you want to install the default MIME types?"
))

(set #ask-install-samples
(cat "\nDo you want to install some sound samples\nfor use with SimpleFTP?"
))

(set #ask-install-mui
(cat "\nDo you want to install the NList, NListview and BetterString MUI classes?\n\n"
      "They will be installed to the SimpleFTP directory, and should not interfere"
      "with any other MUI programs."
))

;**************************************************************************************************

(showmedia 'logo' #logo 'upper_right' 'none' 0)

(user 2)

(welcome
(complete 5)
(set agree (askbool (prompt #copyright)
      (help #install-docs-help)
      (choices "Yes" "No")
     )
)

(if (= agree 0)       (
  (message #not-installed)
  (exit (quiet))
))

;******************************************** Locale Stuff 

(complete 10)
  (set catalog
    (askchoice
      (choices "English (Built-in)" "Czech" "Deutsch" "Español" "Français" "Greek" "Italiano" "Norsk" "Português" "Svenska")
       (prompt #select-lang)
      (help   "None here")
    )
  )
  (set loc-target "LOCALE:Catalogs/")
  (set loc-source "locale/")

  (if (= catalog 1)     (
    (set loc-target (tackon loc-target "Czech"))
    (set loc-source (tackon loc-source "Czech"))
    (set loc-use 1)
  ))

  (if (= catalog 2)     (
    (set loc-target (tackon loc-target "Deutsch"))
    (set loc-source (tackon loc-source "Deutsch"))
    (set loc-use 1)
  ))
   
  (if (= catalog 3)     (
    (set loc-target (tackon loc-target "Español"))
    (set loc-source (tackon loc-source "Español"))
    (set loc-use 1)
  ))

  (if (= catalog 4)     (
    (set loc-target (tackon loc-target "Français"))
    (set loc-source (tackon loc-source "Français"))
    (set loc-use 1)
  ))

  (if (= catalog 5)     (
    (set loc-target (tackon loc-target "Greek"))
    (set loc-source (tackon loc-source "Greek"))
    (set loc-use 1)
  ))

  (if (= catalog 6)     (
    (set loc-target (tackon loc-target "Italiano"))
    (set loc-source (tackon loc-source "Italiano"))
    (set loc-use 1)
  ))

  (if (= catalog 7)     (
    (set loc-target (tackon loc-target "Norsk"))
    (set loc-source (tackon loc-source "Norsk"))
    (set loc-use 1)
  ))

  (if (= catalog 8)     (
    (set loc-target (tackon loc-target "Português"))
    (set loc-source (tackon loc-source "Português"))
    (set loc-use 1)
  ))

  (if (= catalog 9)     (
    (set loc-target (tackon loc-target "Svenska"))
    (set loc-source (tackon loc-source "Svenska"))
    (set loc-use 1)
  ))

(if (= loc-use 1)    (
  (set loc-source (tackon loc-source "SimpleFTP.catalog"))
;  (if (< (exists (loc-target)) 2) makedir loc-target) )
  (copyfiles (
    (source loc-source)
    (dest   loc-target)
  ))
))

;=================== Select destination ===================

(complete 20)
(set target1         (askdir
   (help   "No help here matey!")
   (prompt #select-dir)
   (default "Miami:")
))

(set size (getdiskspace target1))
(If (< size 298480) (
   (message #not-enough-space)
   (exit (quiet))
))

(set target2 target1)

(complete 30)
(copyfiles (
   (prompt "Select files you want installed")
   (help   "Umm....duh?")
   (source  "")
   (dest    target1)
   (choices "SimpleFTP" "SimpleFTP.info" "SimpleFTP.cfg" "SimpleFTP.sites" "Icons" )
   (CONFIRM)
))

(complete 50)
(set mime-install (askbool (prompt #ask-install-default-mime)
      (help #install-docs-help)
      (choices "Yes" "No")
     )
)
(set target2 (tackon target1 "SimpleFTP.MIME"))
(if (= mime-install 1)       (
  (copyfiles (
    (source "SimpleFTP.MIME")
    (dest   target1)
  ))
))       

(closemedia logo)
(showmedia 'register' #register 'upper_right' 'none' 0)

(complete 60)
(set samples-install (askbool
    (prompt #ask-install-samples)
    (help "RTFM")
    (choices "Yes" "No")
  )
)
(if (= samples-install 1) (
  (makedir (tackon target1 "Samples"))
  (copyfiles (
    (source "Samples")
    (dest   (tackon target1 "Samples"))
    (all)
  ))
))

(complete 70)
(set mui-install (askbool
    (prompt #ask-install-mui)
    (help "RTFM")
    (choices "Yes" "No")
  )
)
(if (= mui-install 1) (
  (makedir (tackon target1 "MUI"))
  (copyfiles (
    (source "MUI")
    (dest   (tackon target1 "MUI"))
    (all)
  ))
))

(complete 90)
(copyfiles (
   (prompt "Select files you want installed")
   (help   "Umm...duh?")
   (source "")
   (dest   target1)
   (choices "Docs" "Docs.info")
   (CONFIRM)
))

(closemedia register)
(showmedia 'thanks' #thanks 'upper_right' 'none' 0)
(complete 100)
(message #goodbye)
(message #my-address)

(openwbobject target1)
(exit (quiet))
)
