; $VER: TEMPEST Install 3.51 (8.15.96)
;
; TempesT BBS 3.51 Installation Script
;

(transcript "=T= TEMPEST =T= v3.51 Install...")

; //////////////////////////////
; ///// Get Main Dest Path /////
; //////////////////////////////

(set MPath
 (askdir
  (prompt "\nWhere would you like to install TempesT.\n "
          "Sub Dir 'TempesT' will be created for you.")
  (help "The main TempesT directory where most bbs related "
        "files are stored.  This path must have a good "
        "amount of hd space free, about 20 megs or more.")
  (default "SYS:")
 )
)
(makedir    (tackon MPath "TempesT"))
;(makeassign "TEMPEST" (tackon MPath "TempesT"))

; //////////////////////
; ///// Copy C Dir /////
; //////////////////////

(copyfiles
 (prompt "Copying all C directory files to your C:")
 (source "C")
 (dest "SYS:C")
 (all)
 (optional "nofail" "askuser")
)

; //////////////////////////
; ///// Copy Fonts Dir /////
; //////////////////////////

(copyfiles
 (prompt "Copying all Fonts directory files to your FONTS:")
 (source "FONTS")
 (dest "SYS:FONTS")
 (all)
 (optional "nofail" "askuser")
)

; //////////////////////
; ///// Copy L Dir /////
; //////////////////////

(copyfiles
 (prompt "Copying all L directory files to your L:")
 (source "L")
 (dest "SYS:L")
 (all)
 (optional "nofail" "askuser")
)

; /////////////////////////
; ///// Copy LIBS Dir /////
; /////////////////////////

(copyfiles
 (prompt "Copying all libs directory files to your LIBS:")
 (source "LIBS")
 (dest "SYS:Libs")
 (all)
 (optional "nofail" "askuser")
)

; ///////////////////////////////////
; ///// Copy Tempest Main Files /////
; ///////////////////////////////////

(copyfiles
 (prompt "Copying TempesT files to TEMPEST:")
 (source "Tempest")
 (dest "TEMPEST:")
 (all)
 (optional "nofail" "askuser")
)

; ///////////////////////////////
; ///// Copy Converters Dir /////
; ///////////////////////////////

(makedir  (tackon "TEMPEST:" "Converters"))
(copyfiles
 (prompt "Copying all Converters directory files to TEMPEST:Converters")
 (source "Converters")
 (dest "TEMPEST:Converters")
 (all)
 (optional "nofail" "askuser")
)

; ///////////////////////////
; ///// Set / Copy Docs /////
; ///////////////////////////

(set DPath
 (askdir
  (prompt "\nWhere would you like to copy the =T= Documentation to?\n "
          "Sub dir 'TempesTDocs' will be created for you.")
  (help "The path where you want to store all documentation on =T=.")
  (default "TEMPEST:")
 )
)
(makedir    (tackon MPath "TempesTDocs"))

(copyfiles
 (prompt "Copying =T= Documentation files.")
 (source "TempestDocs")
 (dest (tackon DPath "TempesTDocs"))
 (all)
 (optional "nofail" "askuser")
)

; /////////////////////////////
; ///// Set Resident Flag /////
; /////////////////////////////

(if
 (askbool
  (prompt "\nDo you want to run TempesT resident?")
  (help "Tempest is a 'pure' program, meaning it can be "
         "made resident.  Programs which are resident "
         "have the distinct advantage of being re-entrant; "
         "meaning if you have 3 copies of it running, there "
         "is really only 1 copy taking up memory, with three "
         "different sets of variables.\n\n"
         "This saves a LOT of memory when running TempesT in a "
         "multi-user enviornment, because you are saving about "
         "300k of RAM for *EVERY* extra port you have loaded.\n\n"
         "Even if you are only running 1 line, it's a good idea "
         "to make it resident, since you will probably have a 'port 0' "
         "or other local port up sometimes.\n\n"
         "Note that it does NOT waste memory to have TempesT "
         "made resident even if you are only running 1 port.")
 )
 ; TRUE statement
 (
  (set ResFlag "")
 )
 ; FALSE statement
 (
  (set ResFlag "; ")
  (message "\nThe BBS will NOT be made resident.  However, "
           "in your S:User-Startup file, the lines responsible "
           "for making the BBS resident will appear, but prefixed "
           "with semicolons (;), which comments them out.\n\n"
           "Should you wish to run the BBS resident in the future, "
           "all that needs to be done is removal of those semicolons.")
 )
)

; ////////////////////////////
; ///// Set Startup Flag /////
; ////////////////////////////

(if
 (askbool
  (prompt "\nDo you want to run TempesT automatically when your system "
          "is started?")
  (help "If you wish =T= to automatically be started when your "
        "system is booted then answer YES.")
 )

 ; TRUE statement
 (
  (set RunFlag "")
 )
 ; FALSE statement
 (
  (set RunFlag "; ")
  (message "\nThe BBS will NOT be automatically run on startup. However, "
           "in your S:User-Startup file, the line responsible "
           "for starting the BBS will appear, but prefixed "
           "with a semicolon (;), which comments it out.\n\n"
           "Should you wish to run the BBS automatically on startup in the future, "
           "all that needs to be done is the removal of that semicolon.")
 )
)

; ///////////////////////////////
; ///// Modify User-Startup /////
; ///////////////////////////////

(startup "=T= TEMPEST BBS SOFTWARE =T="
 (prompt "\nA few assignments need to be made to your S:User-Startup "
         "file which allow =T= to find all the files and directories "
         "we've just installed.\n\n")
 (help "=T= requires a few assignments so that it can find "
       "all it's files. ")
 (command
  ("Assign TEMPEST: \"%s\"\n" (getassign "TEMPEST"))
  ("rexxmast >NIL:\n")
  ("%sresident TEMPEST:TEMPEST TEMPEST:TEMPEST FORCE\n" ResFlag )
  ("\n%srun <>NIL: TEMPEST:TServer\n" RunFlag )
 )
)

; ////////////////////////////
; ///// Install Complete /////
; ////////////////////////////

(message "\n=T= Installation Complete!\n\n  You should now further configure "
         "your system using =T= BBSConfig program.\n\n"
         "Do you wish to run BBSConfig now? "
         "BBSConfig is a full GUI (mouse-driven) program that allows you "
         "to configure the BBS.  You *MUST* configure the bbs before running "
         "Tempest.  Make sure to define the screen modes in Display section "
         "and define all paths and click the create paths gadgets. ")

(run "run TEMPEST:BBSCONFIG")
