; ************************************************************************
;
; $VER: D-ACCESS V2.0 INSTALL SCRIPT ©1994 By The Dalai Lama of GOD!
;
; ************************************************************************
;

(complete 0)




(set #getexdir
(cat "\nPlease select the directory that your \n"
     "AMI-EXPRESS PROGRAM is in.\n"
))
(complete 1)

(set #getexdir-help
(cat "Please choose the directory that the\n"
     "EXPRESS PROGRAM is in."
))

(set axtarget (askdir (prompt #getexdir)
		    (help   #getexdir-help)
		    (default "BBS:")
	    )
)
(complete 5)

(set @default-ax (tackon axtarget "express"))

 (set #no-express
 (cat "\nOOPS! Unable to locate " @default-ax 
 ))

(if (exists @default-ax) 
(set expressver ((getversion @default-ax)))
)
(set @check (exists @default-ax))
 (if (= @check 0)
 (abort #no-express)
 )

(set defbbs (askdir (prompt "\nPlease select the Directory where your BBS files\n"
                            "are located.\n")
		    (help   #getexdir-help)
		    (default "BBS:")
	    )
)


(set cpu (database "cpu"))
(set vblank (database "vblank"))
(set graphmem (database "graphics-mem"))
(set totmem (database "total-mem"))
(set osver (/ (getversion "LIBS:version.library") 65536))

( if (= expressver 38) (set exvers "V3.38") )
( if (= expressver 37) (set exvers "V3.37") )
( if (= expressver 36) (set exvers "V3.36") )
( if (= expressver 35) (set exvers "V3.35") )
( if (= expressver 34) (set exvers "V3.34") )
( if (= expressver 33) (set exvers "V2.33") )
( if (= osver 37) ( (set workbench "Workbench v2.0") )
( if (= osver 38) ( (set workbench "Workbench v2.1") )
( if (= osver 39) ( (set workbench "Workbench v3.0") )
( if (= osver 40) ( (set workbench "Workbench v3.1") )
( if (= osver 41) ( (set workbench "Workbench v4.0") )
)))))
(complete 10)


(set #yes     "Yes")
(set #no      "No")
(set #proceed "Proceed")
(set #skip    "Skip")


(set #GroupName      "Gløbal Overdøse")     ; Crew Name
(set #DA             "D-ACCESS V2.0")       ; name of the /X Util

(set #defaulttarget  "Doors:")              ; default destination dir


(set #DADisk         "D-ACCESS_V2.0:")       ; DiskName

(set #bad-express
(cat  #DA " only works with /X V3.34 or higher!"
))

(set #bad-kick
(cat "You must use Kickstart 2.0 to install " #DA
))

(set #introduction
(cat "\n** D-ACCESS Install Program **\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
     "This program will install the software for\n"
     "D-ACCESS V2.0. It takes care of all the\n"
     "necessary steps to get you up and running\n"
     "in the shortest amount of time with the\n"
     "least amount of effort - ENJOY!\n\n"
     "-Dalai Lama-"
))

(set #ask-version
(cat "Please select the version of " #DA " that you wish to run." 
))
(set #ask-version-help
(cat "Please select the version of " #DA " that you wish to run." 
))


(set #ask-copydashow
(cat "\nThere is an extra utility called D-ACCESS SHOW" 
     " that alerts sysops that there are new applications"
     " waiting to be validated. Do you wish to install"
     " this utlity?"
))

(set #ask-copydashow
(cat "\nThere is an extra utility called D-ACCESS SHOW" 
     " that alerts sysops that there are new applications"
     " waiting to be validated. Do you wish to install"
     " this utlity?"
))

(set #copy-restoffiles
(cat "\n\nThere are several support files for " 
     #DA " that need to be copied."
))

(set #copy-restoffiles-help
(cat "\n\nThere are several support files for " 
     #DA " that need to be copied."
))

(set #ask-copy-da-newOS
(cat "Please select the version of " #DA 
     " that you wish to use."
))

(set #ask-copy-da-newOS-help
(cat "Please select the version of " #DA 
     " that you wish to use."
))

(set #ask-copy-da-oldOS
(cat "\nSystems operating under AmigaDos 2.0 are not" 
     " able to run the RexxPlus compiled version"
     " of " #DA ". The RMS version will be"
     "automatically used instead."
))
(set #ask-copy-da-oldOS-help
(cat "\nSystems operating under AmigaDos 2.0 are not" 
     " able to run the RexxPlus compiled version"
     " of " #DA ". The RMS version will be"
     "automatically used instead."
))

(set #ask-installdir
(cat "Please choose a directory, where you want " #DA
     " installed.  A directory named 'D-ACCESS' will be created there."
))

(set #ask-installdir-help
(cat "You have to choose a directory, where the software will be copied. "
     "A directory named 'D-ACCESS' will be created there."
))

(set #copy-toc
(cat "You need to copy several commands to your C: Directory. "
     "D-ACCESS uses these commands regularly.\n"
     "PLEASE SELECT THE COMMANDS YOU DON'T ALREADY HAVE!"
))

(set #copy-toc-help
(cat "These programs are necessary for D-ACCESS to operate "
     "since it uses them often to perform certain tasks."
))


(set #copy-todoors
(cat "\nNow we will copy all the necessary files to the D-ACCESS dir."
))

(set #copy-guide "copying AmigaGuide files ... ")

(set #copy-guide-help
(cat "Now the AmigaGuide docs will be copied to the destination directory. "
     "If you don't want to copy the files, skip this part."
))


(if (< osver 37)
	(abort #bad-kick)
)

(if (< expressver 34)
        (abort #bad-express)
)

(complete 15)



;=============================================================================
;=============================================================================
;======*****              THIS IS THE START OF INSTALL             *****======
;=============================================================================
;=============================================================================


(message #introduction)


(user 1)

(if (= vblank "60") ((set blank "NTSC")) ((set blank "PAL")))
(set fastmem (- totmem graphmem))

(message "SYSTEM INFORMATION\n~~~~~~~~~~~~~~~~~~~\n"
	  "Running Ami-Express "exvers" \n\n"
	   "Version of OS: " workbench"\n\n"
	   cpu " Processor In " blank " Machine\n\n"
           "Free Chip Memory - "graphmem" Bytes\n\n"
           "Free Fast Memory - "fastmem" Bytes\n\n"
           "Total Free Memory - "totmem" Bytes")

(if (= osver 37)
	(message "Since this Machine is running 2.0x\n\nWorkbench 2.0 (V37.61) or\nWorkbench 2.04 (V37.67) or Workbench 2.05 (v37.77)\n\n"
		 "NOW would be a good time to upgrade to 2.1 or higher!")
)


(if (exists "DOORS:D-ACCESS")
(
 (rename "doors:D-ACCESS" "Doors:D-ACCESS.OLD")
 (message "\nYour DOORS:D-ACCESS directory has been\n"
          "renamed to DOORS:D-ACCESS.OLD. You can find\n"
          "all of your old applications etc. there.")
))

(complete 20)

(set sourcedir #DADisk)

(set target (askdir (prompt #ask-installdir)
		    (help   #ask-installdir-help)
		    (default "DOORS:")
	    )
)


(set @default-dest (tackon target "D-ACCESS"))

(if (< (exists @default-dest) 2)
   (makedir @default-dest (infos))
)


(set viewermask (askoptions (choices "COPY    - Copies files."
				     "DELETE  - Deletes files."
				     "LIST    - Lists files"
				     "MAKEDIR - Makes new directories."
				     "SORT    - Sorts lists of data."
                )
           (prompt (cat #copy-toc "\n"))
           (help   #copy-toc-help)
           (default 0)
        )
)
(complete 25)

(if (<> viewermask 0)
 (

        (if (IN viewermask 0)
               (
                (copyfiles (prompt "COPYING 'COPY'")
               	 (source (tackon sourcedir "c/copy"))
	         (dest   "c:")
                 (confirm "expert")
                 (optional)
                )
               )
        )
        (if (IN viewermask 1)
               (
                (copyfiles (prompt "COPYING 'DELETE'")
               	 (source (tackon sourcedir "c/delete"))
	         (dest   "c:")
                 (confirm "expert")
                 (optional)
                )
               )
        )
        (if (IN viewermask 2)
               (
                (copyfiles (prompt "COPYING 'LIST'")
               	 (source (tackon sourcedir "c/list"))
	         (dest   "c:")
                 (confirm "expert")
                 (optional)
                )
               )
        )
        (if (IN viewermask 3)
               (
                (copyfiles (prompt "COPYING 'MAKEDIR'")
               	 (source (tackon sourcedir "c/makedir"))
	         (dest   "c:")
                 (confirm "expert")
                 (optional)
                )
               )
        )
        (if (IN viewermask 4)
               (
                (copyfiles (prompt "COPYING 'SORT'")
               	 (source (tackon sourcedir "c/sort"))
	         (dest   "c:")
                 (confirm "expert")
                 (optional)
                )
               )
        )
 )
)

(complete 30)

(if (exists "DOORS:D-ACCESS")
 (
  (set @default-dest (tackon target "D-ACCESS/NEW_APPS"))
  (makedir @default-dest )

  (set @default-dest (tackon target "D-ACCESS/OLD_APPS"))
  (makedir @default-dest )

  (set @default-dest (tackon target "D-ACCESS/BAD_APPS"))
  (makedir @default-dest )

  (set @default-dest (tackon target "D-ACCESS/D-ACCESS.uploads"))
  (makedir @default-dest )
 )
)

(copyfiles (prompt #copy-guide)
	   (help   #copy-guide-help)
	   (source (tackon sourcedir "Guide"))
	   (dest   (tackon target "D-ACCESS/GUIDE"))
	   (pattern "#?.guide")
	   (confirm "expert")
	   (infos)
)
(complete 35)

(if (= osver 37)
(
        (copyfiles (prompt #ask-copy-da-oldOS)
        (help #ask-copy-da-oldOS-help)
        (source (tackon sourcedir "D-ACCESS.RMS"))
        (dest   (tackon target "D-ACCESS"))
        (optional)
        )
                (copyfiles (prompt "COPYING 'D-ACCESS.RMS'")
               	 (source (tackon sourcedir "RMS/RMS.START"))
	         (dest   (tackon target "D-ACCESS/RMS"))
                 (confirm "expert")
                 (optional)
                )
                (copyfiles (prompt "COPYING 'D-ACCESS.RMS'")
               	 (source (tackon sourcedir "RMS/RMS.CONFIG"))
	         (dest   "S:")
                 (confirm "expert")
                 (optional)
                )
)
  (copyfiles (prompt "COPYING ICONS.")
             (source (tackon sourcedir "BBSCMD"))
             (dest   (tackon defbbs "commands/BBSCMD"))
	     (pattern "~(DAShow.info)")
	     (confirm "expert")
  )
(complete 40)

  (tooltype (settooltype "LOCATION" (tackon target "D-ACCESS/RMS/RMS.START"))
	    (dest  (tackon defbbs "COMMANDS/BBSCMD/DACCESS"))
  )
  (tooltype (settooltype "LOCATION" (tackon target "D-ACCESS/RMS/RMS.START"))
	    (dest  (tackon defbbs "COMMANDS/BBSCMD/1"))
  )

)

(if (> osver 37)
(
(set viewermask (askoptions (choices "D-ACCESS.RP  -  RexxPlus Compiled Version."
				     "D-ACCESS.RMS -  RexxMasher Encrypted Version."
                )
           (prompt (cat #ask-copy-da-newOS "\n"))
           (help   #ask-copy-da-newOS-help)
           (default 1)
        )
)


(if (<> viewermask 0)
 (

        (if (IN viewermask 0)
               (
                (copyfiles (prompt "COPYING 'D-ACCESS.RP'")
               	 (source (tackon sourcedir "D-ACCESS.RP"))
	         (dest   (tackon target "D-ACCESS"))
                 (confirm "expert")
                 (optional)
                )
               )
        )
        (if (IN viewermask 1)
               (
                (copyfiles (prompt "COPYING 'D-ACCESS.RMS'")
               	 (source (tackon sourcedir "D-ACCESS.RMS"))
	         (dest   (tackon target "D-ACCESS"))
                 (confirm "expert")
                 (optional)
                )
                (copyfiles (prompt "COPYING 'D-ACCESS.RMS'")
               	 (source (tackon sourcedir "RMS/RMS.START"))
	         (dest   (tackon target "D-ACCESS/RMS"))
                 (confirm "expert")
                 (optional)
                )
                (copyfiles (prompt "COPYING 'D-ACCESS.RMS'")
               	 (source (tackon sourcedir "RMS/RMS.CONFIG"))
	         (dest   "S:")
                 (confirm "expert")
                 (optional)
                )
               )
        )
  )
 )
(complete 45)

;=============================================================================

(set version (askchoice (choices "RexxPlus Version" "RexxMasher Version" )
			 (prompt #ask-version)
	                 (help   #ask-version-help)
          		 (default 0)
	  )
)

( if (= version 0)	( (set version1 "RMS/RMS.START") )
( if (= version 1)	( (set version1 "D-ACCESS.RP") )
))

(set @destloc (tackon target "D-ACCESS")) 
(tooltype (settooltype "LOCATION" (tackon @destloc version1))
	  (dest   (tackon defbbs "COMMANDS/BBSCMD/1"))
)
(tooltype (settooltype "LOCATION" (tackon @destloc version1))
	  (dest   (tackon defbbs "COMMANDS/BBSCMD/DACCESS"))
)

;=============================================================================

)
)
(complete 50)

(message #copy-restoffiles)
(copyfiles (prompt #copy-restoffiles)
	   (help   #copy-restoffiles-help)
	   (source sourcedir)
           (dest   (tackon target "D-ACCESS"))
	   (pattern "(D-ACCESS.~(RMS|RP))")
	   (confirm "expert")
)
(complete 55)

(if (= (askbool (prompt  #ask-copydashow)
		(help    #ask-copydashow-help)
		(default 1)
		(choices #proceed #skip)
	)
	1)

(
  (copyfiles (prompt "COPYING FILE 'D-AccessShow'")
             (source sourcedir)
             (dest   (tackon target "D-ACCESS"))
	     (pattern "D-AccessShow")
	     (confirm "expert")
  )
  (copyfiles (prompt "COPYING ICON 'DAShow.info' to your BBSCmd Drawer.")
             (source (tackon sourcedir "BBSCMD"))
             (dest   (tackon defbbs "commands/BBSCMD"))
	     (pattern "DAShow.info")
	     (confirm "expert")
  )
  (message "\nIn order for D-AccessShow to function you need "
           "to add the MCI command line '~CC_DASHOW' to your "
           (tackon defbbs "NODEx/BULLx.TXT text files."))
 )
)

(message "\nNow we will configure the tooltypes in the D-ACCESS icon."
         " Please refer to the documentation for information about"
         " the functioning of each tooltype.")
(
(set askresult (askstring (prompt "\nPlease enter minimum access level that can\n"
                   "use the sysop commands:")
                 (help "Enter the minimum access level for sysop commands.")
                 (default "255")
               )
)
  (set @destloc (tackon target "D-ACCESS/D-ACCESS")) 
  (tooltype (settooltype "SYSOP_LEVEL" askresult)
	    (dest  @destloc)

)

  (tooltype (settooltype "USER_DATA_PATH" (tackon defbbs "USER.DATA"))
	    (dest  @destloc)

)

(complete 75)

(set askresult (askstring (prompt "\nPlease enter a PASSWORD for access to the SYSOP\n"
                                   "commands. If you leave this blank then any user\n"
                                   "that has access to D-ACCESS V2.0 will be able to\n"
                                   "use the sysop command menu!")
                 (help "Enter PASSWORD for SYSOP COMMANDS.")
                 (default "")
               )
)
  (tooltype (settooltype "SYSOP_PASSWORD" askresult)
	    (dest  @destloc)

)
(complete 85)

(if (= askresult "")
  (tooltype (settooltype "COSY_ACCOUNT_EDIT" "NO")
	    (dest  @destloc)

)
)
(if (<> askresult "")
  (tooltype (settooltype "COSY_ACCOUNT_EDIT" "YES")
	    (dest  @destloc)

)
)

(complete 90)

;**************************************************************************
(set coname "COSY_NAME.")
(if (<> askresult "")
(
(set endflag 1)
(set #cosynum 1)
(while (= endflag 1)
(

(set askresult (askstring (prompt "\nEnter the handles of all the cosysops that you\n"
                                  "want to have access to the sysop menu. Don't\n"
                                  "forget to include yourself.\n"
                                  " \n"
                                  "Leave name blank and click [Proceed] to exit.\n\n"
                                  "* NOW ENTERING COSYSOP NAME # " #cosynum " *")
                 (help "Enter Sysop & Cosysop names.")
                 (default "")
               )
)

(if (= askresult "")
(set endflag 0))
 
(if (<> askresult "")
(
  (set cname (cat coname #cosynum))

  (tooltype (settooltype cname askresult)
	    (dest  @destloc)
)
(set #cosynum (+ #cosynum 1))
)
)
)
)
)
)
;**************************************************************************



(complete 91)

(set askresult (askstring (prompt "\nPlease enter maximum chat time for\n"
                   "new accounts in MINUTES:")
                 (help "Enter the minimum chat time for new accounts.")
                 (default "30")
               )
)
  (tooltype (settooltype "PRESET_CHAT_LIMIT" askresult)
	    (dest  @destloc)

)

(set lamer (askchoice (prompt "\nDo you want 'Donation Info' zmodem downloaded by new\n"
                              "users from certain area codes instead of being given\n"
                              "an application for access?\n")
                 (help "Answer YES or NO.")
                 (default 1)
                 (choices #yes #no)
               )
)
(if (= lamer 0) ( (set lamer1 "YES") )
(if (= lamer 1) ( (set lamer1 "NO") )
)
)
  (tooltype (settooltype "DONATE_INFO" lamer1)
	    (dest  @destloc)
)

(if (= lamer1 "YES")
(
 (set askresult (askstring (prompt "\nPlease enter PATH & FILENAME of\n"
                   "your 'Donation Info' file:")
                 (help "Enter path & filename of your donation info file.")
                 (default "DOORS:D-ACCESS/D-ACCESS.TXT")
                 )
 )
  (tooltype (settooltype "DONATE_INFOFILE" askresult)
	    (dest  @destloc)
  )
 )
)
(complete 95)

;**************************************************************************
(set lamer (askchoice (prompt "\nDo you want users from certain area codes\n"
                              "restricted from being able to log on as a new user?\n")
                 (help "Answer YES or NO.")
                 (default 1)
                 (choices #yes #no)
               )
)
(if (= lamer 0) ( (set lamer1 "YES") )
(if (= lamer 1) ( (set lamer1 "NO") )
)
)

(set coname "AREA_CODE.")
  (tooltype (settooltype "ACODE_BLOCK" lamer1)
	    (dest  @destloc)
  )
(if (= lamer 0)
(

(set endflag 1)
(set #cosynum 1)
(while (= endflag 1)
(

(set askresult (askstring (prompt "\nEnter the AREA CODES you want new users blocked\n"
                                  "from. New users from these area codes will\n"
                                  "optionally be given donation information and then\n"
                                  "logged off instead of being allowed to fill out\n"
                                  "an application (We suggest that you block local\n"
                                  "area codes.)\n"
                                  " \n"
                                  "Leave area code blank and click [Proceed] to exit.\n\n"
                                  "* NOW ENTERING AREA CODE # " #cosynum " *")
                 (help "Enter Sysop & Cosysop names.")
                 (default "")
               )
)

(if (= askresult "")
(set endflag 0))
 
(if (<> askresult "")
(
  (set cname (cat coname #cosynum))

  (tooltype (settooltype cname askresult)
	    (dest  @destloc)
)
(set #cosynum (+ #cosynum 1))
)
)
)
)
)
)
;**************************************************************************

(complete 98)

(set lamer (askchoice (prompt "\nDo you want new users to be REQUIRED to\n"
                   "upload their single newest file:")
                 (help "Answer YES or NO.")
                 (default 0)
                 (choices #yes #no)
               )
)
(if (= lamer 0) ( (set lamer1 "YES") )
(if (= lamer 1) ( (set lamer1 "NO") )
)
)
  (tooltype (settooltype "NEWUSER_UPLOAD" lamer1)
	    (dest  @destloc)
)

(if (= lamer1 "YES")
(
 (set askresult (askstring (prompt "\nPlease enter PATH where you want\n"
                   "the new user's uploads to go:")
                 (help "Enter path of your new user files.")
                 (default "DOORS:D-ACCESS/D-ACCESS.UPLOADS")
                 )
 )
  (tooltype (settooltype "UPLOAD_PATH" askresult)
	    (dest  @destloc)
  )
 )
)

(if (= lamer1 "YES")
(
(set lamer (askchoice (prompt "\nDo you want the new user's uploads DELETED\n"
                   "after they are sent:")
                 (help "Answer YES or NO.")
                 (default 0)
                 (choices #yes #no)
               )
)
(if (= lamer 0) ( (set lamer1 "YES") )
(if (= lamer 1) ( (set lamer1 "NO") )
)
)
  (tooltype (settooltype "DELETE_UPLOAD" lamer1)
	    (dest  @destloc)
)
)
)

(set lamer (askchoice (prompt "\nDo you want new users dropped if they\n"
                   "leave a blank line in the application:")
                 (help "Answer YES or NO.")
                 (default 0)
                 (choices #yes #no)
               )
)
(if (= lamer 0) ( (set lamer1 "YES") )
(if (= lamer 1) ( (set lamer1 "NO") )
)
)
  (tooltype (settooltype "BLANKLINE_LOGOFF" lamer1)
	    (dest  @destloc)
)

(set lamer (askchoice (prompt "\nWhen the application is completed you can have\n"
                   "the new user either:")
                 (help "Answer YES or NO.")
                 (default 0)
                 (choices "LOG OFF automatically.     *OR*"
                          "Leave the SYSOP a message.")
               )
)
(if (= lamer 0) ( (set lamer1 "NO") (set lamer2 "YES") )
(if (= lamer 1) ( (set lamer1 "YES") (set lamer2 "NO") )
)
)
  (tooltype (settooltype "SYSOP_MESSY" lamer1)
	    (dest  @destloc)
)
  (tooltype (settooltype "AUTO_GOODBY" lamer2)
	    (dest  @destloc)

)

)

(set newconf (askdir (prompt "\nPlease select your NEW USER CONFERENCE.\n")
		    (help   #getexdir-help)
		    (default "BBS:")
	    )
)
                 (copyfiles (prompt "COPYING 'BULL.TXT'")
               	 (source (tackon sourcedir "bull.txt"))
	         (dest   newconf )
                 (confirm "expert")
                 (optional)
                 )
(complete 99)

(if (exists (tackon defbbs "COMMANDS/SYSCMD/SCRIPT.info"))
 (delete (tackon defbbs "COMMANDS/SYSCMD/SCRIPT.info"))
)

(set @default-dest (tackon target "D-ACCESS/"))
(complete 100)

(exit)
