; $VER: Install_Printers 38.12 (30.1.92)
; Script to install new printer drivers on an existing Workbench 2.1 system

(complete 0)
(delopts "oknodelete" "force" "askuser")


;=============================================================================
; English strings

(set #bad-kick
(cat "You must be using Kickstart 2.04 to install Workbench 2.1"
))

(set #bad-boot
(cat "Please boot from the \"Amiga Install\" disk Version 2.1 "
     "before running this installation program"
))

(set #about-this-thing
(cat "\n\nThis program lets you add new printer drivers on an already installed "
     "Workbench 2.1 hard drive unit. Your Amiga will then be able to control "
     "printers of that type by selecting them in the Input preferences "
     "program."
))

(set #about-this-thing-help
(cat "\nThe Amiga can control many different printers. "
     "Printer drivers are files that let the Amiga adapt to a given "
     "printer. There must be a printer driver copied to "
     "hard drive for each printer supported.\n\n"
     @askoptions-help
))

(set #which-disk
(cat "In which disk or drawer is Workbench 2.1 installed?"
))

(set #which-disk-help
(cat "\nThis section lets you indicate in which drawer or on which disk "
     "Workbench 2.1 is currently installed. That information will be used "
     "to determine where the new printer drivers should be copied.\n\n"
     "The drawer you are expected to specify is the same one as you chose "
     "when installing Workbench 2.1 using the Install 2.1 program elsewhere "
     "on this disk.\n\n"
     @askdir-help
))

(set #confirm-target
(cat "\n\nYour Workbench 2.1 files appear to be located in the \"%s\" "
     "drawer.\n\n"
     "Is this correct?"
))

(set #confirm-target-help
(cat "\nThis program has determined that your current Workbench 2.1 files "
     "appear to be located in the \"%s\" drawer. That information will be "
     "used to determine where the new printer drivers should be copied.\n\n"
     "Select the \"No\" gadget if your Workbench 2.1 files are not located "
     "in \"%s\". You will then be able to pick an alternate location."
))

(set #which-printer
(cat "Which printer drivers should be installed?"
))

(set #which-printer-help
(cat "\nThe Amiga can control many different printers. "
     "Printer drivers are files that let the Amiga adapt to a given "
     "printer. There must be a printer driver copied to "
     "hard drive for each printer supported.\n\n"
     "Simply check the boxes of the printers you will "
     "to have available on your system.\n\n"
     @askoptions-help
))

(set #ask-extras
(cat "\n\nPlease insert the \"Amiga Extras\" disk Version 2.1 in any floppy drive unit."
))

(set #ask-extras-help
(cat @askdisk-help
))

(set #what-next
(cat "The printer drivers you have selected are now in place. You can choose any "
     "of these by launching the \"Input\" preferences program found in the "
     "\"Prefs\" drawer in \"%s\"."
))


;=============================================================================
; French strings

(if (= @language "franįais")
(
(set #bad-kick
(cat "Il vous faut utiliser Kickstart 2.04 pour installer le Workbench 2.1"
))

(set #bad-boot
(cat "Veuillez démarrer votre Amiga ā partir de la disquette"
     "\"Amiga Install\" version 2.1 avant de lancer ce programme"
))

))


;=============================================================================
; German strings

(if (= @language "deutsch")
(
(set #bad-kick
(cat "Sie müssen Kickstart 2.04 zum Unstallieren von Workbench 2.1 benutzen"
))

(set #bad-boot
(cat "Bitte starten Sie mit der Diskette \"Amiga Install\" Version 2.1, "
     "bevor Sie dieses Installationsprogramm starten."
))

))


;=============================================================================
; Dutch strings

(if (= @language "nederlands")
(
(set #bad-kick
(cat "U moet Kickstart 2.04 gebruiken om Workbench 2.1 te installeren"
))

(set #bad-boot
(cat "Start a.u.b. uw systeem op met de \"Amiga Install\" diskette "
     "Versie 2.1 voordat u dit installatie programma opstart."
))

))


;=============================================================================
; Italian strings

(if (= @language "italiano")
(
(set #bad-kick
(cat "Dovete usare il Kickstart 2.04 per installare il Workbench 2.1!"
))

(set #bad-boot
(cat "Ripartire dal dischetto \"Amiga Install\" Versione 2.1 "
     "prima di avviare questo programma di installazione"
))

))


;=============================================================================
; Danish strings

(if (= @language "dansk")
(
(set #bad-kick
(cat "De skal benytte Kickstart 2.04 for installation af Workbench 2.1"
))

(set #bad-boot
(cat "Vær venlig at boote fra \"Amiga Install\" disken Version 2.1 "
     "før De afvikler dette installations program"
))

))


;=============================================================================
; Swedish strings

(if (= @language "svenska")
(
(set #bad-kick
(cat "Du måste använda Kickstart 2.04 för att kunna installera Workbench 2.1"
))

(set #bad-boot
(cat "Starta om datorn från disketten \"Amiga Install\" Version 2.1 "
     "innan du försöker starta detta installationsprogram"
))

))


;=============================================================================
; make sure we are running under a 2.04 ROM

(if (< (/ (getversion) 65536) 37)
(
    (abort #bad-kick)
))


;=============================================================================
; make sure we booted from the 2.1 Install disk

(if (<> (getassign "SYS" "a") "Install2.1:")
(
    (abort #bad-boot)
))


;=============================================================================
; explain what we are all about...

(message #about-this-thing
         (help #about-this-thing-help)
)


;*****************************************************************************
;*****************************************************************************
;*****************************************************************************
; useful procedures

(procedure TERMINATE (makeassign "..EXTRAS..")
)


;*****************************************************************************
;*****************************************************************************
;*****************************************************************************
; install printer drivers

;=============================================================================
; termination stuff

(onerror (TERMINATE))


;=============================================================================
; get target directory where update is to be installed

(user 2)

; A3000
(set old_wb (getassign "WB_2.x" "d"))
(if (= old_wb "")
(
    ; A2091/A590
    (set old_wb (getassign "Workbench" "d"))
    (if (= old_wb "")
    (
	; A2090a
	(set old_wb (getassign "BOOT" "d"))
	(if (<> old_wb "")
	(
	    (run "mount fh0: fh1: FROM BOOT:devs/MountList.HD")
	    (run "mount fh0: fh1: FROM BOOT:devs/MountList")
	    (set old_wb (expandpath "FH0:"))
	)
	(
	    ; A2090 SCSI
	    (set old_wb (getassign "DH2" "d"))
	    (if (= old_wb "")
	    (
		; A2090 ST506
		(set old_wb (getassign "DH0" "d"))
		(if (= old_wb "")
		(
		    (set old_wb (askdir (prompt #which-disk)
					(help #which-disk-help)
					(default "")
				)
		    )
		))
	    ))
	))
    ))
))

(if (askbool (prompt (#confirm-target old_wb old_wb))
             (help (#confirm-target-help old_wb old_wb))
             (default 1)
    )
(
    (set target old_wb)
)
(
    (set target (askdir (prompt #which-disk)
                        (help #which-disk-help)
                        (default old_wb)
                )
    )
))

(set @default-dest target)


;=============================================================================
; now copy the drivers

(set prt (askoptions (prompt #which-printer)
                     (help #which-printer-help)
                     (choices "CalComp Printers"
                              "CBM MPS1000"
                              "Diablo 630"
                              "Epson Printers"
                              "Howtek PixelMaster"
                              "HP Printers"
                              "ImageWriter II"
                              "NEC PinWriter"
                              "Okimate Printers"
                              "PostScript"
                              "Seiko Printers"
                              "Sharp JX-730"
                              "Tektronix Printers"
                              "Toshiba Printers"
                              "Xerox 4020"
                     )
                     (default 0)
          )
)

(askdisk (prompt #ask-extras)
	 (help #ask-extras-help)
	 (dest "Extras2.1")
	 (newname "..EXTRAS..")
)

(set n 0)
(set printerpat "(%")
(while (set printer (select n "CalComp_#?"
                              "CBM_MPS1000#?"
                              "Diablo_630#?"
                              "Epson#?"
                              "Howtek_Pixelmaster#?"
                              "HP#?"
                              "ImagewriterII#?"
                              "NEC_Pinwriter#?"
                              "Oki#?"
                              "PostScript#?"
                              "Seiko#?"
                              "Sharp_JX-730#?"
                              "Tektronix#?"
                              "Toshiba#?"
                              "Xerox_4020#?"
                              ""
		     )
       )
(
    (if (IN prt n)
    (
        (set printerpat (cat printerpat "|" printer))
    ))
    (set n (+ n 1))
))

(copyfiles (source (cat "..EXTRAS..:Storage/Printers"))
           (dest (tackon target "Devs/Printers"))
           (pattern (cat printerpat ")"))
)

(complete 100)


;=============================================================================
; "Say goodnight Gracy."
;
(TERMINATE)

(exit (#what-next target))


;=============================================================================
; this is never executed
(welcome)
