; ____
; )___) Kevin Carthew
;(___(  Install script written for Chris Elsworth
;
;SET UP ALL THE NEEDED VARIABLES!
(set cpu             (database "cpu"))
(set #myaddress      "For support contact the author at\n\n lightbulb@borghome.demon.co.uk." )
(set #welcome        "\nInstaller,\n\nAlways make sure you have enough room!\n \nHydra-MAX Installer Script for MAXsBBS.\n\nThis script requires the BBS: assign that MAX uses!" )
(set #advise         "\nYou should now take a look at and configure\nthe files\nHydra.GFG - Files.CFG - Area.CFG" )
(set #goodbye        "Hydra-MAX Installation Complete!\n\n Install Script by Kevin Carthew.")

;DISPLAY THE WELCOME MESSAGE!
(message #welcome)
(welcome)

;SET UP A FEW MORE IMPORTANT VARIABLES
(set #continue "Continue with installation?")
(set #aborted "Installation aborted!")
(set #yes "Yes!")
(set #no "No!")
(set #which-disk "All of the Hydra program will be installed in BBS: the MAX Assign.  Select now the BBS: Assign.")
(set #which-disk-help "\nThis section asks you where to install Hydra on your Hard Disk or partition.\n\n")
(set #doc-which-disk "Where do you want me to put the docs?")
;ERROR MESSAGE VARIABLES
(set #err_CantMakeDirectory "An error has occured! Please check that the path you specified was correct and retry.")
(set #err_CantFindDirectory "Couldnt find the directory you specified, please check and try again.")

;CHECKING DIRECTORIES FOR INSTALL
(if ( exists "BBS:" (noreq) )
   (set @default-dest "BBS:")
   (if ( exists "BBS:" (noreq) )
      (set @default-dest "WORK:")
      (set @default-dest "SYS:")
   )
)

;START THE INSTALL - COMPLETED 0%
(complete 0)

;SELECT WHERE TO BUNG IT!
(set target
    (askdir (prompt #which-disk)
        (help #which-disk-help @askdir-help)
        (default @default-dest)
    )
)

(makedir (tackon target "Doors"))


(if ( exists target (noreq) )
   (
      (set target (tackon target "Doors/Hydra" ) )
      (if ( exists target (noreq) )
         (message "Re-Installing over previous version...")
         (
            (makedir target (infos) )
            (if ( exists target (noreq) )
               (set dirmade 1 )
               (exit #err_CantMakeDirectory )
            )
         )
      )
   )
   (exit #err_CantFindDirectory)
)

(set @default-dest target)

;MAKE ALL THE DIRECTORIES NEEDED
(makeassign "Hydra" target)
(makedir (target) )
(makedir (tackon target "Display") )
(makedir (tackon target "Configs") )
(makedir (tackon target "Users") )

(makedir ("BBS:FileAreas"))
(makedir ("BBS:TempArc"))
(makedir ("BBS:TEMP_RECEIVE"))


(complete 10)

(copyfiles
   (source "Display/")
   (dest (tackon target "Display"))
   (choices "AccessSettings" "ArchiveList" "Archiving" "CheckUploads" "DescribeFiles" "FileAreas" "FileInfo" "ListingScreen" "MainMenu" "NoAccess" "NoFileID" "NoMarked" "NoMem" "NotFound" "NoUploads" "Online_Help" "Preselect" "Search" "SearchFileAreas" "SearchHeader" "SelectFiles" "UserPrefs" "WantToUpload")
   (confirm)
   (prompt "Which files do you need?")
   (help "These are all boring, crap default ANSI's - look at them and customize them")
)

(complete 30)

(copyfiles
   (source "Configs/")
   (dest (tackon target "Configs"))
   (Choices "Hydra.CFG" "Files.CFG" "Area.CFG")
   (confirm)
   (prompt "Which files do you want?")
   (help "If you are updating an old version and have your own configs do not copy these but study them for any new changes")
   (infos)
)

(complete 40)

(copyfiles
   (source "Users/")
   (dest (tackon target "Users"))
   (Choices "M.Default" "Chris_Elsworth")
   (confirm)
   (prompt "Which files do you need?")
   (help "These files are for UserPrefs, do not delete them!")
   (infos)
)

(complete 45)

(copyfiles
   (source "")
   (dest target)
   (choices "HYDRA_ENHN_R" "LZXAddAd.BAT" "LhAAddAd.BAT" "Rec.Bat" "LogOff" "LogOffNoOut" "Hydra.GUIDE")
   (confirm)
   (prompt "Which files do you need?")
   (help "These are the main executables, always copy them. But check the batch files. Do not overwrite any customised batches you have.")
   (infos)
)

(complete 80)

(copylib
   (source "Libs/AMOS.Library")
   (dest "LIBS:")
   (confirm)
   (help "This library is needed to run the doors and LogOff programs")
   (prompt "AMOS.Library may need updating!")
   (infos)
)

(complete 90)

(copyfiles
   (source "C/")
   (dest "C:")
   (choices "DMSDescript" "EXEDescript" "GIFDesc" "ModuleDescript" "TXTExtract")
   (confirm)
   (prompt "Which files do you need?")
   (help "All these files handle the File_ID.diz extracting, so copy them if you don't have them already.")
   (infos)
)

(copyfiles
   (source "C/")
   (dest "C:")
   (choices "Smodem" "HydraCom""XPRD")
   (confirm)
   (prompt "Which files do you need?")
   (help "These files handle the file transfers, always copy them!")
   (infos)
)

(message "\n\n\n\n\nI am just running the LogOff\nexecutable so you can run H-MAX as\nsoon as you have edited the configs!")

(run "logoff")

(message #advise)

(complete 100)

(exit #goodbye #myaddress)
