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

(complete 0)




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

(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:")
	    )
)
(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 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 "Workbench2.0:") (set extras "Extras2.0:") )
( if (= osver 38) ( (set workbench "Workbench2.1:") (set extras "Extras2.1:") )
( if (= osver 39) ( (set workbench "Workbench3.0:") (set extras "Extras3.0:") )
( if (= osver 40) ( (set workbench "Workbench3.1:") (set extras "Extras3.1:") )
( if (= osver 41) ( (set workbench "Workbench4.0:") (set extras "Extras4.0:") )
)))))


(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~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThis program will install the software for "#DA
     ". It takes all necessary steps and takes care of "
     "the operating system version. Without your permission "
     "the installation will not perform any changes on important files "
     "like the \"S:Startup-Sequence\"."
))

(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)
)




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


(message #introduction)


(user 1)

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

(message "Basic System Check Of This Machine\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
	  "Running Ami-Express "exvers" \n\n"
	   workbench " Version of OS\n\n"
	   cpu " Processor In " blank " Machine\n\n"
           graphmem  " Total Free Chip Memory\n\n"
	   fastmem  " Total Free Fast Memory\n\n  " totmem " Total Free Memory\n")

(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.")
))


(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))
)

(complete 1)

(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)
        )
)

(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)
                )
               )
        )
 )
)


(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 )
 )
)

(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 ICONS.")
             (source (tackon sourcedir "BBSCMD"))
             (dest   "BBS:commands/BBSCMD")
	     (pattern "~(DAShow.info)")
	     (confirm "expert")
  )

  (tooltype (settooltype "LOCATION" (tackon target "D-ACCESS/D-ACCESS.RMS"))
	    (dest  "BBS:COMMANDS/BBSCMD/DACCESS")
  )
  (tooltype (settooltype "LOCATION" (tackon target "D-ACCESS/D-ACCESS.RMS"))
	    (dest  "BBS: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)
                )
               )
        )
  )
 )

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

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

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

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

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

)
)

(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")
)

(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   "BBS: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 "
           "BBS: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)

)
(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)

)

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

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

)
)


;**************************************************************************
(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))
)
)
)
)
)
)
;**************************************************************************




(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)
  )
 )
)

;**************************************************************************
(set coname "AREA_CODE.")
  (tooltype (settooltype "ACODE_BLOCK" lamer1)
	    (dest  @destloc)
  )
(if (= lamer1 "YES")
(

(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 be given\n"
                                  "donation information and then logged off instead of\n"
                                  "being allowed to fill out an application (We suggest\n"
                                  "that you block local 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))
)
)
)
)
)
)
;**************************************************************************


(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 @default-dest (tackon target "D-ACCESS/"))

(exit)
