;
; /* $VER: MESSPlus Installer Script 1.0 (12.7.98)
;    Installer script © 1998 Arnaud Danassie alias "bigdan" on #artbas
;    & #amigafr - E-mail : danassie@club-internet.fr
;    MESSPlus © 1998 Johann GIRARD-CHERON - E-mail: sammy@hol.fr */
;
; Setup all messages
;
(if (not (= @language "français"))
   ( 
     (set #welcome    "\nWelcome to MESSPlus Installation !\n\nMESSPlus © 1998 Johann GIRARD-CHERON\n(e-mail : sammy@hol.fr)")
     (set #badkick    "\nKickstart 2.04 or higher is required for MESSPlus !\n\nAn upgrade will be needed for your Amiga...")
     (set #selectdir  "\nWhere do you want to install MessPlus ?  A drawer called \"MessPlus\" will be created autmotically." )
     (set #guichoice  "You can use MESSPlus with 2 different GUIs,\nwhich one would you like ?")
     (set #copylibr   "Copying %s.library...")
     (set #copydocs   "Copying docs of...")
     (set #copycom    "Copying %s command in C: directory...")
     (set #muirexx    "MUIRexx is required for MessPlus !\n\n\MUIRexx#?.lha is available on Aminet/dev/mui ....\n\nInstall MUIRexx BEFORE install Mui version of MessPlus\nOR install Gadtools version of MessPlus !!!")
     (set #muirexx2   "I need MUIRexx in C:, Install it properly...")
     (set #exit       "\n\nMESSPlus 1.0 Installation done !\n\nThere is some important things to know about your modem\n\nPlease read the IMPORTANT part of the guide file...")
   )
)
(if (= @language "français")

   ( 
     (set #welcome    "\nBienvenue dans l'installation de MESSPlus !\n\nMESSPlus © 1998 Johann GIRARD-CHERON\n(e-mail : sammy@hol.fr)")
     (set #badkick    "\nKickstart 2.04 ou supérieur nécessaire pour MESSPlus !\n\nPensez à upgrader votre Amiga...")
     (set #selectdir  "\nOù installe t'on MessPlus ?  Un répertoire \"MessPlus\" sera crée automatiquement." )
     (set #guichoice  "Vous pouvez utilisez MESSPlus avec 2 interfaces graphiques différentes,\nlaquelle voulez-vous installer ?")
     (set #copylibr   "Copie de la librairie %s...")
     (set #copydocs   "Copie de la documentation de ...")
     (set #copycom    "Copie de la commande %s dans le répertoire C: ...")
     (set #muirexx    "MUIRexx est nécessaire pour faire fonctionner MUIMessPlus !\n\n\MUIRexx#?.lha est disponible sur Aminet/dev/mui ....\n\nInstallez MUIRexx AVANT d'installer MessPlus version Mui\nOU installez la version Gadtools de MessPlus !!!")
     (set #muirexx2   "J'ai besoin de MUIRexx dans C:, Installez le proprement...")
     (set #exit       "\n\nMESSPlus 1.0 Installation terminée !\n\nIl y a des choses importantes à savoir concernant vôtre modem\n\nLisez l'IMPORTANTE documentation amigaguide...")
   )
)


(complete 0)
(set @default-dest "Sys:")
(message #welcome)
; Check KS >= 37 (2.04+)

(if (< (/ (getversion) 65536) 37) (abort #badkick))
(complete 10)

; Where..

(set Path.source (pathonly @icon))

(set Path.dest
   (askdir
     (prompt #selectdir)
     (help @askdir-help) 
     (default "Sys:")
   )
)
(set Path.dest (tackon Path.dest "MessPlus"))
(makedir Path.dest (infos))
(set @default-dest Path.dest)
(complete 15)

; Choice between MUI or GADTOOLS Gui

(set #gui
    (askchoice
       (prompt #guichoice)
       (help @askchoice-help)
       (choices "MUI" "GADTOOLS")
       (default 0)
    )
)
(complete 20)
;
; Copy various Libs required by both MUI/GADTOOLS versions...
;
(copylib
     (prompt (#copylibr "arexxport"))
     (source (tackon Path.source "libs/arexxport.library"))
     (dest "Libs:")
     (confirm)
     (help @copylib-help)
)
(complete 25)
(copylib
     (prompt (#copylibr "dignet"))
     (source (tackon Path.source "libs/dignet.library"))
     (dest "Libs:")
     (confirm)
     (help @copylib-help)
)
(complete 27)
(copylib
     (prompt (#copylibr "reqtools"))
     (source (tackon Path.source "libs/reqtools.library"))
     (dest "Libs:")
     (confirm)
     (help @copylib-help)
)
(complete 29)
(copylib
     (prompt (#copylibr "rexxreqtools"))
     (source (tackon Path.source "libs/rexxreqtools.library"))
     (dest "Libs:")
     (confirm)
     (help @copylib-help)
)
(complete 32)
;
; Copy docs....
;
(makedir (tackon Path.dest "docs") (infos))
(complete 35)
;
(copyfiles (source (tackon Path.source "docs"))(dest (tackon Path.dest "docs"))(help @copyfiles-help)(all)(infos))
;
(complete 47)
;
; Copy C: commands...
;
(copyfiles (prompt (#copycom "NewWait")) (source (tackon Path.source "c/newwait")) (dest "C:") (help @copyfiles-help))
(copylib (prompt (#copycom "DignetKill")) (source (tackon Path.source "c/DignetKILL")) (dest "C:") (help @copylib-help))
(copylib (prompt (#copycom "LoadLib")) (source (tackon Path.source "c/LoadLib")) (dest "C:") (help @copylib-help))
(complete 50)
(copyfiles (prompt "Installing MESSPlus Scripts...")
           (source (tackon Path.source "rexx/Mess+_Active.rexx"))
           (dest "Rexx:")
           (help @copyfiles-help)
)
(complete 55)
(copyfiles (prompt "Installing MESSPlus Scripts...")
           (source (tackon Path.source "rexx/Mess+_Inactive.rexx"))
           (dest "Rexx:")
           (help @copyfiles-help)
)
(complete 60)
;
; Install MUI Version
;

(if (= #gui 0)
   (
     ; Check if MUIRexx is installed.. (chek assign and
     ; if MUIRexx exists in C: or Utilities: )
     (if (not (exists "muirexx:" (noreq)))
         (abort #muirexx)
     ; else...
         (
           (if (not (exists "c:MuiRexx"))
             (if (not (exists "Sys:utilities/MuiRexx"))
                 (abort #muirexx2)
                 ; else
                 (copyfiles (source "Sys:utilities/MuiRexx")
                            (dest "c:") (help @copyfiles_help)
                 )
             )
           )
         )
     )
     ;
     ; Copy MUI MessPlus files
     ;
     (complete 70)
     (if (= @language "français")
        (copyfiles (source (tackon Path.source "muimess+/locale/catalog/français/MUIMessPlus.catalog"))
                   (dest "Locale:catalogs/français") (help @copyfiles_help)
        )
     )
     (complete 80)
     (copyfiles (prompt "Installing MESSPlus Scripts...")
                (source (tackon Path.source "muimess+/rexx/MUIMessPlus.rexx"))
                (dest "Rexx:")
                (help @copyfiles-help)
     )
     (complete 90)
     (copyfiles (source (tackon Path.source "muimess+/MUIMessPlus"))
                (dest Path.dest)
                (help @copyfiles-help)
                (infos)
                (files)
     )
   )
)

;
; Install GADTOOLS Version 
;
(if (= #gui 1)
  (
    (copylib
      (prompt #copycom "varexx")
      (source (tackon Path.source "c/varexx"))
      (dest "C:")
      (help @copylib-help)
    )
    (complete 70)
    (copyfiles (prompt (#copycom "VXC"))
               (source (tackon Path.source "c/VXC"))
               (dest "C:") (help @copyfiles-help)
    )
    (copyfiles (prompt "Installing MESSPlus Scripts...")
               (source (tackon Path.source "rexx"))
               (dest "Rexx:")
               (help @copyfiles-help)
               (pattern "#?.rexx")
               (files)
    )
    (complete 80) 
    (if (not (= @language "français"))
        (copyfiles (source (tackon Path.source "rexx/messplus.gui"))
                   (dest "Rexx:") (help @copyfiles_help)
        )
    )
    (if (= @language "français")
        (copyfiles (source (tackon Path.source "rexx/messplus.guifr"))
                   (dest "Rexx:") (newname "messplus.gui") (help @copyfiles_help)
        )
    )
    (complete 90)
    (copyfiles (source (tackon Path.source "MessPlus"))
               (dest Path.dest)
               (help @copyfiles-help)
               (infos)
               (files) 
    )
  )
)
(complete 100)
(exit #exit)
