; Janus v2.1 Installation Script
; Written by Greg Givler and John J. Szucs
; Amiga Systems Section Product Assurance
; $VER: Install 1.00 2-25-92
; Send bug reports to givler@cbmvax.commodore.com

; setup return to be nonzero so that I can loop

(set return 1)

    ; set fontcopy to 0 so that I can handle Danish and Swedish font
; sets.

(set fontcopy 0)

; Set keydone to 0 so that I don't install keymap files twice.

(set keydone 0)

; setup the default destination.

(set @default-dest "SYS:PC")

; Setup the default boot partition

(set bootpart "SYS:")

; get the version of the operating system

(set vernum (getversion))
(set ver (/ vernum 65536))

; Get the type of processor in the machine

(set processor (database "cpu"))

; Set up conditionals for the type of processors so that I can ask
; for enforcer at the right times.

(if (NOT (OR (= processor "68000") (= processor "68010")))
    (set accel 1)
    (set accel 0)
)

; find out where T: is assigned, we don't want it assigned to disk.

(set gett (getassign "t" ))
(if (NOT (= gett "RAM DISK:T"))
    (
        (if (NOT (exists "ram:t"))
            (
                (makedir "RAM:T")
            )
        )
        (makeassign "T" "RAM:T")
    )
)
; this finds the configuration of the machine and places it in a file in T:

(run "AmigaJanus:c/config >t:config.file")
(run "search >t:controller t:config.file 2090")
(run "search >t:bbd0 t:config.file 513/103")
(run "search >t:bbd1 t:config.file 513/1(")
(run "search >t:bbdx t:config.file 513")
(run "search >t:setcpu.search %sS/Startup-Sequence setcpu")

; This is to be added to if there are other boards out there that have a need
; for binddrivers later in the startup-sequence.
;(run "search >>t:controller t:config <anyotherboard>")

; if a wierd booting board is present ask the user what kind of Boot procedure he has


(set boot
    (askbool
        (prompt "Does your system have separate boot and system partitions")
        (help "If your system has separate boot and system partitions it is necessary for the BindDrivers command to be run later in your Startup-Sequence."
                "If you answer yes the BindDrivers command will be inserted in your \"S:User-Startup\" This will allow your system to be tranferred to the proper partition before the bridgeboard becomes active."
        )
        (default 0)
    )
)
(if (= boot 1)
    (
        (set bootpart (askdir
                (prompt "Please Select Your Boot Partition.")
                (help "The Boot Partition is the partition that is used to transfer the system to the Workbench partition, with a 2090A this is called Boot:")
                (default "Boot:")
            )
        )
        (while (NOT (exists ("%s/s/startup-sequence" bootpart)))
            (
                (set bootpart (askdir
                        (prompt ("The partition %s does not contain the file s/startup-sequence, please select the \"Show Drives\" button and select another partition." bootpart))
                        (help "The partition that you selected does not contain a startup-seqeuence, a boot partition would have a startup-sequence, please select a partition with a startup-sequence.")
                        (default "SYS:")
                    )
                )
            )
        )
        ; Need to get the size of the startup sequence and then add 512 bytes
        ; so that the creation of the s/User-Startup file doesn't fill the
        ; partition.
        (set startsize (+ (getsize ("%s/s/startup-sequence" bootpart)) 512))
        (while (< (getdiskspace ("%s" bootpart)) startsize)
            (
                (message ("There is not enough room to create a backup of your %s/s/Startup-Sequence. Please delete some files on %s" bootpart bootpart))
            )
            (
                (startup "Janus Binddrivers"
                    (prompt "Placing the command \"Binddrivers\" into your User-Startup")
                    (help "The Bridgeboard needs Janus.Library and Janus.Library to be in SYS:Expansion, when the Binddrivers command is called. In some boot configurations SYS: is assigned to a partition that is not the active partition at the time of boot. As a result it is necessary for a second Binddrivers command to be run so that the Bridgeboard can find Janus.Library. This is required for the Bridgeboard to work properly.")
                    (command "Binddrivers")
                )
            )
        )
    )
)
(delete "t:controller")

; ask the user to tell us what BridgeBoard he has
(set bbd0 (getsize "t:bbd0"))
(set bbd1 (getsize "t:bbd1"))
(set bbdx (getsize "t:bbdx"))
(set cpu (getsize "t:setcpu.search"))

(if (> bbd0 1)
    (set bbd-default 0)
)
(if (> bbd1 1)
    (set bbd-default 1)
)
(if (AND (<= bbd0 1) (<= bbd1 1))
    (set bbd-default 2)
)
(if (<= bbdx 1)
    (message "Install is unable to find the Bridgeboard hardware.")
)
(set bbtype (askchoice
            (prompt "Please Select the type of BridgeBoard that you have installed in your system.")
            (help "This allows the Install to place the proper files for the Bridgeboard.")
            (choices    "A2386"
                        "A2088 or A2286"
                        "Sidecar"
            )
            (default bbd-default)
    )
)
; Ask the user to configure the install
(if (OR (AND (>= ver 36) (= accel 1)) (> cpu 1))
    (
        (if (exists "sys:pc/system/aboot.ctrl")
            (set defaultmask 76)
            (set defaultmask 77)
        )
        (if (OR (= bbtype 1) (= bbtype 2))
            (
                (set defaultmask (- defaultmask 8))
                (if (= bbtype 2)
                    (set defaultmask (- defaultmask 4))
                )
            )
        )
        (if (= bbtype 0)
            (
                (run ("search >t:enf.search %sS/Startup-Sequence enforcer" bootpart))
                (run ("search >t:cpu.search %sS/Startup-Sequence CPU" bootpart))
                (run "search >t:flip.search S:User-Startup flipper")
                (run ("search >>t:flip.search %sS/Startup-Sequence flipper" bootpart))
                (set enfsize (getsize "t:enf.search"))
                (set cpusize (getsize "t:cpu.search"))
                (set flipsize (getsize "t:flip.search"))
                (if (OR (NOT (<= enfsize 1)) (NOT (<= cpusize 1)))
                    (
                        (set defaultmask (- defaultmask 64))
                    )
                )
                (if (> flipsize 2)
                    (
                        (set defaultmask (- defaultmask 8))
                    )
                )
            )
        )
        (set optionmask (askoptions
                (prompt "Please Select any of the following options")
                (help "INSTALL MAKEAB HARDDRIVE - This option allows you to setup an AutoBoot Virtual Drive as described in the Manual\n\n"
                    "INSTALL DJMOUNT - This Option allows you to install the DJMount command. This command mounts a PC Hard Drive for use as an Amiga Hard drive. The first Amiga Partition on a PC Hard Disk Drive will be called JH0:, the second JH1: and so on. See your manual for more information.\n\n"
                    "RUN PCPREFS - This Option allows you to run the program PCPrefs. PCPrefs will allow you to set the defaults that you wish for your Bridgeboard. PCPrefs will not run if the Bridgeboard hardware is not present. Use this option only if you have installed the Bridgeboard hardware.\n\n"
                    "RUN FLIPPER AT BOOT - This Option places the appropriate command to run the Flipper program when you start your Amiga, in your S:User-Startup file. If the file is not present it creates it and places the command to execute User-Startup in your %sS/Startup-Sequence.\n\n"
                    "RUN PCWINDOWS - This option opens a requester that asks if you want run PC COLOR or PC MONO at boot time. Be advised that you must set your bridgeboard hardware to match the selected color or mono display, otherwise the display will not function properly. See your Bridgeboard manual on how to set the default display.\n\n"
                    "RUN LPT1 OR LPT1X AT BOOT - This option assigns your Amiga parallel port to the Bridgeboard at the time of boot. Be advised that you will not be able to use your parallel port for any Amiga use until the this program is closed.\n\n"
                    "INSTALL ENFORCER OR CPU  - This option allows the user to run Enforcer or CPU at boot. This is NECESSARY for 2.0 systems with a 68020 or greater processor, otherwise the Bridgeboard will not operate properly."
                )
                (choices    "Install MakeAB HardDrive"
                            "Install DJMount"
                            "Run PCPrefs at end of Installation"
                            "Run Flipper at Boot"
                            "Run PC Window at Boot..."
                            "Run LPT1 or LPT1X at Boot ..."
                            "Install Enforcer, CPU or SetCPU ..."
                )
                (default defaultmask)
            )
        )
    )
    (
        (if (exists "sys:pc/system/aboot.ctrl")
            (set defaultmask 12)
            (set defaultmask 13)
        )
        (if (OR (= bbtype 1) (= bbtype 2))
            (
                (set defaultmask (- defaultmask 8))
                (if (= bbtype 2)
                    (set defaultmask (- defaultmask 4))
                )
            )
        )
        (set optionmask (askoptions
                (prompt "Please Select any of the following options")
                (help "INSTALL MAKEAB HARDDRIVE - This option allows you to setup an AutoBoot Virtual Drive as described in the Manual\n\n"
                    "INSTALL DJMOUNT - This Option allows you to install the DJMount command. This command mounts a PC Hard Drive for use as an Amiga Hard drive. The first Amiga Partition on a PC Hard Disk Drive will be called JH0:, the second JH1: and so on. See your manual for more information.\n\n"
                    "RUN PCPREFS - This Option allows you to run the program PCPrefs. PCPrefs will allow you to set the defaults that you wish for your Bridgeboard. PCPrefs will not run if the Bridgeboard hardware is not present. Use this option only if you have installed the Bridgeboard hardware.\n\n"
                    ("RUN FLIPPER AT BOOT - This Option places the appropriate command to run the Flipper program when you start your Amiga, in your S:User-Startup file. If the file is not present it creates it and places the command to execute User-Startup in your %sS/Startup-Sequence.\n\n" bootpart)
                    "RUN PCWINDOWS - This option opens a requester that asks if you want run PC COLOR or PC MONO at boot time. Be advised that you must set your bridgeboard hardware to match the selected color or mono display, otherwise the display will not function properly. See your Bridgeboard manual on how to set the default display.\n\n"
                    "RUN LPT1 OR LPT1X AT BOOT - This option assigns your Amiga parallel port to the Bridgeboard at the time of boot. Be advised that you will not be able to use your parallel port for any Amiga use until the this program is closed.\n\n"
                )
                (choices    "Install a MakeAB HardDrive"
                            "Install a PC HardDrive"
                            "Run PCPrefs at end of Installation"
                            "Run Flipper at Boot"
                            "Run PC Window at Boot ..."
                            "Run LPT1 or LPTX at Boot ..."
                )
                (default defaultmask)
            )
        )

    )
)

; Keymap routine

(set keymap (askchoice
        (prompt "Please choose the Keymap that you wish to use.")
        (help "For the Bridgeboard to work properly you must choose the country keymap that you desire."
            "If you wish to only change the keymap, after the correct keymap is copied, select NO when asked if you wish to procede with the Janus Install."
        )
        (choices    "US"
                    "Dansk"
                    "Deutsch"
                    "Espaol"
                    "Franais"
                    "English (UK)"
                    "Italiano"
                    "Suisse-Franais"
                    "Sweiss-Deutsch"
                    "Svenska/Suomi"
                    "Norsk"
        )
        (default 0)
    )
)
(if (NOT(= keymap 0))
    (
        (if (= keymap 1)
            (
                (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.dk")
                (set fontcopy 1)
            )
        )
        (if (= keymap 2)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.d")
        )
        (if (= keymap 3)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.e")
        )
        (if (= keymap 4)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.f")
        )
        (if (= keymap 5)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.gb")
        )
        (if (= keymap 6)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.i")
        )
        (if (= keymap 7)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.ch1")
        )
        (if (= keymap 8)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.ch2")
        )
        (if (= keymap 9)
            (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.s")
        )
        (if (= keymap 10)
            (
                (set defaultkeymap "AmigaJanus:PCWKeymap/PCWKeymap.n")
                (set fontcopy 1)
            )
        )
        (if (exists "SYS:PC/System")
            (copyfiles
                (source ("%s" defaultkeymap))
                (dest "SYS:PC/System")
                (files)
            )
        )
        ; This copies the proper fonts files for Dansk and Norsk
        ; That way the you can get the theta character necessary
        ; for the character set, since that character is not in the
        ; standard character set.
        (if (= fontcopy 0)
            (
                (copyfiles
                    (source "AmigaJanus:Fonts/PCFont")
                    (dest "Fonts:PCFont")
                    (fonts)
                    (all)
                )
                (if (NOT (exists "Fonts:PCFont.font"))
                    (
                        (copyfiles
                            (source "AmigaJanus:Fonts/PCFont.font")
                            (dest "Fonts:")
                            (files)
                        )
                    )
                )
            )
            (
                (copyfiles
                    (source "AmigaJanus:Fonts/PCFont-SC")
                    (dest "Fonts:PCFont")
                    (fonts)
                    (all)
                )
                (if (NOT (exists "Fonts:PCFont-SC.font"))
                    (
                        (copyfiles
                            (source "AmigaJanus:Fonts/PCFont-SC.font")
                            (dest "Fonts:")
                            (files)
                        )
                    )
                )
                (rename "Fonts:PCFont-SC" "Fonts:PCFont")
                (rename "Fonts:PCFont-SC.font" "Fonts:PCFont.font")
            )
        )

; This rename kludge is in here to compensate for a
; bug in copyfiles with the newname option. So I figured I better do
; it myself

        (set defaultfile (fileonly ("%s" defaultkeymap)))
        (set keymappath (tackon "SYS:PC/SYSTEM" defaultfile))
        (if (exists ("%s" keymappath))
            (
                (if (exists "SYS:PC/SYSTEM/PCWKeymap")
                    (
                        (delete "SYS:PC/SYSTEM/PCWKeymap")
                    )
                )
                (rename ("%s" keymappath) "SYS:PC/SYSTEM/PCWKeymap")
                (set keydone 1)
            )
        )
    )
    (
        (if (exists "SYS:PC/System/PCWKeymap")
            (
                (delete "SYS:PC/System/PCWKeymap")
            )
        )
    )
)

; First to see if this is a reinstall

(if (exists "sys:pc")
    (
        (if (=
                (askbool
                    (prompt "This will update your existing Janus Software\n WARNING! This process will delete your existing Janus Software!\n Do you wish to proceed?")
                    (help "This process will delete all existing Janus related files and replace it with the updated software on the AmigaJanus disk.")
                    (default 1)
                )
            0)
            (
                (exit)
            )
            (
                ; check to see if the user has a Psuedo-HardDrive
                ; if he does copy the aboot.ctrl to ram to copy back later.
                (if (exists "sys:pc/system/aboot.ctrl")
                    (
                        (copyfiles
                            (source "sys:pc/system/aboot.ctrl")
                            (dest "t:")
                        )
                        ; set a flag so that I know to recopy ABOOT.CTRL when I am done
                        (set update 1)
                    )
                )
                ; since this is a re-install we want to keep the same PCPrefs, unless we have an OLD PCPrefs file from Janus 2.0 or earlier.
                (if (AND (exists "sys:pc/system/2500prefs") (< (getsize "sys:pc/system/2500Prefs") 2))
                    (
                        ; This is to get rid of a 1 byte 2500Prefs file left over from
                        ; Janus 2.0 and before. If I don't get rid of them then there is
                        ; a good chance that the file will be locked and we will be unable
                        ; to complete the install. I will have to place a message with a
                        ; help statement.

                        (delete "sys:pc/system/2500prefs")

                        ; This is a check to see if the file was deleted, if not I have
                        ; to explain how to get rid of the file.

                        (if (exists "sys:pc/system/2500Prefs")
                            (message "WARNING!!!\n\nThe file \"SYS:PC/System/2500Prefs\" was not deleted\n"
                                        "If this file is not deleted you will be unable to save your PCPrefs Settings\n"
                                        "Select Help for an explanation of how to delete the file."
                                (help "The file SYS:PC/System/2500Prefs was not deleted by the Installer, this happens because the system has a lock on the file."
                                    "To delete the file you must edit your %sS/Startup-Sequence file and commment out the line \"Binddrivers\""
                                    "To comment out the line go to the line in your editor and place a semi-colon (;) as the first character of the line, and save the file."
                                    "You should then be able to reboot, open a shell and type the following command at the prompt:"
                                    "\nDelete sys:pc/system/2500prefs\n"
                                    "Then you must re-edit your %sS/Startup-Sequence and uncomment the \"Binddrivers\" line by removing the leading semi-colon (;)"
                                    "If you do not do this you will not be able to save your PCPrefs settings."
                                )
                            )
                        )
                        ; set a flag so that I know to recopy 2500Prefs when I am done
                        (set update1 0)
                    )
                    (
                        (if (exists "sys:pc/system/2500prefs")
                            (
                                (copyfiles
                                    (source "sys:pc/system/2500prefs")
                                    (dest "t:")
                                )
                                (delete "sys:pc/system/2500prefs")
                                ; set a flag so that I know to recopy 2500Prefs when I am done
                                (set update1 1)
                            )
                        )
                    )
                )
                ; Preserve the PCWKeymap
                (if (exists "sys:pc/system/PCWKeymap")
                    (
                        (copyfiles
                            (source "sys:pc/system/PCWkeymap")
                            (dest "t:")
                        )
                        ; set a flag so that I know to recopy PCWKeymap when I am done
                        (set update2 1)
                    )
                )
                ; delete the old janus files

                (run "delete sys:pc all")
                (delete "c:DJmount")
                (delete "c:makeab")
                (run "delete sys:expansion/Janus.Library#?")

                (while (< (getdiskspace "sys:") 250000)
                    (askbool
                        (prompt "Insufficient Free Space on SYS:\n Select \"Help\" for more information\n")
                        (help "There is insufficient free space to install Janus on the SYS: partition You may delete unnecessary files and select Retry, or select Cancel to abort the installation process.\n")
                        (choices "Retry" "Cancel")
                    )
                )
                (if (< (getdiskspace "sys:") 250000)
                    (askbool
                        (prompt "Insufficient Free Space on SYS:\n Select \"Help\" for more information\n")
                        (help "There is insufficient free space to install Janus on the SYS: partition You may delete unnecessary files and select Retry, or select Cancel to abort the installation process.\n")
                        (choices "Retry" "Cancel")
                    )
                    (
                        (askdisk
                            (prompt "Please insert your AmigaJanus disk into any drive")
                            (help "The Installation program cannot find the AmigaJanus disk. It must be present for the installation to continue.")
                            (dest "AmigaJanus")
                            (assigns)
                        )
                        (copyfiles
                            (source "AmigaJanus:PC")
                            (dest "sys:PC")
                            (all)
                        )
                        (delete "sys:pc/pc color.info")
                        (delete "sys:pc/pc mono.info")
                        (delete "sys:pc/pcprefs.info")
                        (delete "sys:pc/pchard.info")
                        (delete "sys:pc/lpt1.info")
                        (delete "sys:pc/lpt1x.info")
                        (if (AND (NOT (= keymap 0)) (= keydone 0))
                            (
                                (if (exists "SYS:PC/System")
                                    (copyfiles
                                        (source ("%s" defaultkeymap))
                                        (dest "SYS:PC/System")
                                        (files)
                                    )
                                )

                                ; This rename kludge is in here to compensate for a
                                ; bug in copyfiles with the newname option. So I figured I better do
                                ; it myself
                                (set defaultfile (fileonly ("%s" defaultkeymap)))
                                (set keymappath (tackon "SYS:PC/SYSTEM" defaultfile))
                                (if (exists ("%s" keymappath))
                                    (
                                        (delete "SYS:PC/SYSTEM/PCWKeymap")
                                        (rename ("%s" keymappath) "SYS:PC/SYSTEM/PCWKeymap")
                                    )
                                    (
                                        (message ("DEBUG\n\nWARNING!!! Cannot find SYS:PC/SYSTEM/%s" defaultfile))
                                    )
                                )
                            )
                        )
                        (copyfiles
                            (source "AmigaJanus:SysIcons")
                            (dest "sys:PC")
                            (infos)
                            (all)
                        )
                        (if (exists "SYS:PC")
                            (foreach "SYS:PC" "#?.info" (tooltype (swapcolors)))
                        )
                        (copyfiles
                            (source "AmigaJanus:Bridge/Janus.Library")
                            (dest "sys:Expansion")
                            (files)
                        )
                        (copyfiles
                            (source "AmigaJanus:Expansion/Janus.Library.info")
                            (dest "sys:Expansion")
                            (files)
                            (infos)
                        )
                        (if (NOT (exists "sys:pc.info"))
                            (
                                (copyfiles
                                    (source "AmigaJanus:PC.info")
                                    (dest "sys:")
                                    (files)
                                    (infos)
                                )
                                (tooltype
                                    (dest "sys:pc.info")
                                    (noposition)
                                    (swapcolors)
                                )
                            )
                        )
                        (if (= bbtype 0)
                            (copyfiles
                                (source "AmigaJanus:2386")
                                (dest "sys:pc/system")
                                (all)
                            )
                        )
                        (if (= bbtype 1)
                            (
                                (copyfiles
                                    (source "AmigaJanus:Bridge/PC.boot")
                                    (dest "sys:pc/system")
                                    (files)
                                )
                                (if (exists "sys:pc/flipper")
                                    (
                                        (delete "sys:pc/flipper")
                                        (delete "sys:pc/ flipper .info")
                                    )
                                )
                            )
                        )
                        (if (= bbtype 2)
                            (
                                (copyfiles
                                    (source "AmigaJanus:side/LPT1S")
                                    (dest "sys:pc")
                                    (newname "LTP1")
                                    (files)
                                )
                                (if (exists "sys:pc/pcprefs")
                                    (
                                        (delete "sys:pc/pcprefs")
                                        (delete "sys:pc/ pcprefs .info")
                                    )
                                )
                                (if (exists "sys:pc/LPT1X")
                                    (
                                        (delete "sys:pc/lpt1x")
                                        (delete "sys:pc/ lpt1x .info")
                                    )
                                )
                                (if (exists "sys:pc/flipper")
                                    (
                                        (delete "sys:pc/flipper")
                                        (delete "sys:pc/ flipper .info")
                                    )
                                )
                            )
                        )
                        (copyfiles
                            (source "AmigaJanus:c/DJMount")
                            (dest "c:")
                            (files)
                        )
                        (copyfiles
                            (source "AmigaJanus:c/MakeAB")
                            (dest "c:")
                            (files)
                        )
                        (if (= fontcopy 0)
                            (
                                (copyfiles
                                    (source "AmigaJanus:Fonts/PCFont")
                                    (dest "Fonts:PCFont")
                                    (fonts)
                                    (all)
                                )
                                (if (NOT (exists "Fonts:PCFont.font"))
                                    (
                                        (copyfiles
                                            (source "AmigaJanus:Fonts/PCFont.font")
                                            (dest "Fonts:")
                                            (files)
                                        )
                                    )
                                )
                            )
                            (
                                (copyfiles
                                    (source "AmigaJanus:Fonts/PCFont-SC")
                                    (dest "Fonts:PCFont")
                                    (fonts)
                                    (all)
                                )
                                (if (NOT (exists "Fonts:PCFont-SC.font"))
                                    (
                                        (copyfiles
                                            (source "AmigaJanus:Fonts/PCFont-SC.font")
                                            (dest "Fonts:")
                                            (files)
                                        )
                                    )
                                )
                                (rename "Fonts:PCFont-SC" "Fonts:PCFont")
                                (rename "Fonts:PCFont-SC.font" "Fonts:PCFont.font")
                            )
                        )
                        (copyfiles
                            (source "AmigaJanus:devs/Jdisk.device")
                            (dest "devs:")
                            (files)
                        )
                        ; this will remove the files that may be in WB Startup
                        (if (exists "sys:WBStartup")
                            (
                                (if (exists "sys:WbStartup/PC Color.info")
                                    (delete "sys:wbstartup/pc color.info")
                                )
                                (if (exists "sys:wbstartup/pc mono.info")
                                    (delete "sys:wbstartup/pc mono.info")
                                )
                                (if (exists "sys:wbstartup/ flipper .info")
                                    (delete "sys:wbstartup/ flipper .info")
                                )
                                (if (exists "sys:wbstartup/ lpt1 .info")
                                    (delete "sys:wbstartup/ lpt1 .info")
                                )
                                (if (exists "sys:wbstartup/ lpt1x .info")
                                    (delete "sys:wbstartup/ lpt1x .info")
                                )
                                (if (exists "sys:wbstartup/ pcreset .info")
                                    (delete "sys:wbstartup/ pcreset .info")
                                )
                            )
                        )
                    )
                )
                (if (= update 1)
                    (
                        (if (exists "t:aboot.ctrl")
                            (
                                (copyfiles
                                    (source "t:aboot.ctrl")
                                    (dest "sys:pc/system")
                                )
                                (delete "t:aboot.ctrl")
                            )
                        )
                    )
                )
                (if (= update1 1)
                    (
                        (if (exists "t:2500Prefs")
                            (
                                (copyfiles
                                    (source "t:2500Prefs")
                                    (dest "sys:pc/system")
                                )
                                (delete "t:2500Prefs")
                            )
                        )
                    )
                )
                (if (= update2 1)
                    (
                        (if (exists "t:PCWKeymap")
                            (
                                (copyfiles
                                    (source "t:PCWKeymap")
                                    (dest "sys:pc/system")
                                )
                                (delete "t:PCWKeymap")
                            )
                        )
                    )
                )
            )
        )
    )
    (
        (while (< (getdiskspace "sys:") 250000)
            (askbool
                (prompt "Insufficient Free Space on SYS:\n Select \"Help\" for more information\n")
                (help "There is insufficient free space to install Janus on the SYS: partition You may delete unnecessary files and select Retry, or select Cancel to abort the installation process.\n")
                (choices "Retry" "Cancel")
            )
        )
        (if (< (getdiskspace "sys:") 250000)
            (askbool
                (prompt "Insufficient Free Space on SYS:\n Select \"Help\" for more information\n")
                (help "There is insufficient free space to install Janus on the SYS: partition You may delete unnecessary files and select Retry, or select Cancel to abort the installation process.\n")
                (choices "Retry" "Cancel")
            )
            (
                (askdisk
                    (prompt "Please insert your AmigaJanus disk into any drive")
                    (help "The Installation program cannot find the AmigaJanus disk. It must be present for the installation to continue.")
                    (dest "AmigaJanus")
                )
                (copyfiles
                    (source "AmigaJanus:PC")
                    (dest "sys:PC")
                    (infos)
                    (all)
                )
                (if (NOT (= keymap 0))
                    (
                        (if (exists "SYS:PC/System")
                            (copyfiles
                                (source ("%s" defaultkeymap))
                                (dest "SYS:PC/System")
                                (files)
                            )
                        )

                        ; This rename kludge is in here to compensate for a
                        ; bug in copyfiles with the newname option. So I figured I better do
                        ; it myself
                        (set defaultfile (fileonly ("%s" defaultkeymap)))
                        (set keymappath (tackon "SYS:PC/SYSTEM" defaultfile))
                        (if (exists ("%s" keymappath))
                            (
                                (if (exists "SYS:PC/SYSTEM/PCWKeymap")
                                    (delete "SYS:PC/SYSTEM/PCWKeymap")
                                )
                                (rename ("%s" keymappath) "SYS:PC/SYSTEM/PCWKeymap")
                            )
                            (
                                (message ("DEBUG\n\nWARNING!!! Cannot find SYS:PC/SYSTEM/%s" defaultfile))
                            )
                        )
                    )
                )
                (copyfiles
                    (source "AmigaJanus:PC.info")
                    (dest "sys:")
                    (files)
                )
                (tooltype
                    (dest "sys:pc.info")
                    (noposition)
                    (swapcolors)
                )
                (copyfiles
                    (source "AmigaJanus:SysIcons")
                    (dest "sys:PC")
                    (infos)
                    (all)
                )
                (if (exists "SYS:PC")
                    (foreach "SYS:PC" "#?.info" (tooltype (swapcolors)))
                )
                (copyfiles
                    (source "AmigaJanus:Bridge/Janus.Library")
                    (dest "sys:Expansion")
                    (files)
                )
                (copyfiles
                    (source "AmigaJanus:Expansion/Janus.Library.info")
                    (dest "sys:Expansion")
                    (files)
                    (infos)
                )
                (if (= bbtype 0)
                    (copyfiles
                        (source "AmigaJanus:2386")
                        (dest "sys:pc/system")
                        (all)
                    )
                )
                (if (= bbtype 1)
                    (
                        (copyfiles
                            (source "AmigaJanus:Bridge/PC.boot")
                            (dest "sys:pc/system")
                            (files)
                        )
                        (if (exists "sys:pc/flipper")
                            (
                                (delete "sys:pc/flipper")
                                (delete "sys:pc/ flipper .info")
                            )
                        )
                    )
                )
                (if (= bbtype 2)
                    (
                        (copyfiles
                            (source "AmigaJanus:side/LPT1S")
                            (dest "sys:pc")
                            (newname "LTP1")
                            (files)
                        )
                        (if (exists "sys:pc/pcprefs")
                            (
                                (delete "sys:pc/pcprefs")
                                (delete "sys:pc/ pcprefs .info")
                            )
                        )
                        (if (exists "sys:pc/LPT1X")
                            (
                                (delete "sys:pc/lpt1x")
                                (delete "sys:pc/ lpt1x .info")
                            )
                        )
                    )
                )
                (copyfiles
                    (source "AmigaJanus:c/DJMount")
                    (dest "c:")
                    (files)
                )
                (copyfiles
                    (source "AmigaJanus:c/MakeAB")
                    (dest "c:")
                    (files)
                )
                (if (= fontcopy 0)
                    (
                        (copyfiles
                            (source "AmigaJanus:Fonts/PCFont")
                            (dest "Fonts:PCFont")
                            (fonts)
                            (all)
                        )
                        (if (NOT (exists "Fonts:PCFont.font"))
                            (
                                (copyfiles
                                    (source "AmigaJanus:Fonts/PCFont.font")
                                    (dest "Fonts:")
                                    (files)
                                )
                            )
                        )

                    )
                    (
                        (copyfiles
                            (source "AmigaJanus:Fonts/PCFont-SC")
                            (dest "Fonts:PCFont")
                            (fonts)
                            (all)
                        )
                        (if (NOT (exists "Fonts:PCFont-SC.font"))
                            (
                                (copyfiles
                                    (source "AmigaJanus:Fonts/PCFont-SC.font")
                                    (dest "Fonts:")
                                    (files)
                                )
                            )
                        )
                        (rename "Fonts:PCFont-SC" "Fonts:PCFont")
                        (rename "Fonts:PCFont-SC.font" "Fonts:PCFont.font")
                    )
                )
                (copyfiles
                    (source "AmigaJanus:devs/Jdisk.device")
                    (dest "devs:")
                    (files)
                )
            )
        )
    )
)
        ; Check to see if option 1 is set and if it is act upon it.
        ; Install MakeAB Drive
        (if (= (IN optionmask 0) 1)
            (
                (message "The Install Procedure will now set up part of your Amiga hard disk drive as a PC hard disk drive. This mechanism is known as an AutoBoot virtual drive.")
                (if (exists "sys:pc/system/aboot.ctrl")
                    (message "WARNING!\nThe file \"SYS:PC/SYSTEM/ABOOT.CTRL\" is present. If you continue the install will destroy an existing AutoBoot Virtual Drive. Do you want to continue? If you have deleted an AutoBoot Virtual Drive File but did not delete the Aboot.ctrl file then this procedure is safe and you can continue. Otherwise we would recommend that you not continue your AutoBoot Virtual Drive will be preserved.")

                )
                (while (NOT (= return 0))
                    (
                        (set exvol (getassign "Work" "v,a,d"))
                        ; Because of the limitations of the installer and typing of varables
                        ; the if line below must be set the way it is to make it work.
                        ; ideally all I should have to do is (if (= exvol 0) <stuff>)
                        ; But that does not work, believe me.
                        (if (= ("%ld" exvol) "0")
                            (
                                (set defaultdir "")
                            )
                            (
                                (set defaultdir "Work:")
                            )
                        )
                        (set directory (askdir
                                (prompt "Please choose the directory that you wish to place your AutoBoot virtual drive. The default is Work:")
                                (help "This places the AutoBoot drive in the directory that you choose. It is recommended that you have at least 5MBs of free disk space.")
                                (default ("%s" defaultdir))
                            )
                        )
                        ; DEBUG!! This is commented out until I can figure out what the problem is with this. I have an idea it is the typing problem.
                        (set return 0)
                        ;(if (OR (NOT (= return 0)) (NOT (= ("%s" return) "0")))
                        ;    (
                        ;        (message "WARNING!!\n\nYou must have a colon in the pathname where you wish to place your AutoBoot Virtual Drive.")
                        ;    )
                        ;)
                        ; END DEBUG
                    )
                )
                (set max_size (/ (getdiskspace ("%s" directory)) (* 1024 1024)))
                (if (> max_size 32)
                    (set max_size 32)
                )
                (set def_size 10)
                (if (> def_size max_size)
                    (set def_size max_size)
                )
                (set size (asknumber
                        (prompt ("Enter the size of the AutoBoot virtual drive in MegaBytes.\n\nThe maximum allowable size is 32 MegaBytes. Please be reminded that you need to have enough free space on the hard disk drive that you chose to have the AutoBoot virtual drive installed.\nThe default size is 10 MegaBytes.\nMaximum Size is %ld" max_size))
                        (help "You must have enough room on your hard drive for the file that MakeAB creates.")
                        (range 1 max_size)
                        (default def_size)
                    )
                )
                ; Now to figure out how many cylinders to make the AB drive

                (set heads 4)
                (set sectors 17)
                (set block 512)

                ; This mess below figures out how many cylinders that you need to create a MakeAB volume of the right size.

                (set cylinders (/ (/ (/ (* size (* 1024 1024)) heads) sectors) block))

                ; debug to make sure that the formula is working properly.
                ; (message ("directory = %s\nheads = %ld\n sectors = %ld\ncylinders = %ld\n" directory heads sectors cylinders))

                ; see if there is enough room on the drive to create the makeAB virtual drive
                (while (< (getdiskspace ("%s" directory)) (* size (* 1024 1024)))
                    (
                        (message ("There is not enough free disk space to create a the AutoBoot virtual drive on %s" directory))
                        (set max_size (/ (getdiskspace ("%s" directory)) (* 1024 1024)))
                        (if (> max_size 32)
                            (set max_size 32)
                        )
                        (set def_size 10)
                        (if (> def_size max_size)
                            (set def_size max_size)
                        )
                        (set size (asknumber
                                (prompt ("Enter the size of the AutoBoot virtual drive in MegaBytes.\n\nThe maximum allowable size is 32 MegaBytes. Please be reminded that you need to have enough free space on the hard disk drive that you chose to have the AutoBoot virtual drive installed.\nThe default size is 10 MegaBytes.\nMaximum Size is %ld" max_size))
                                (help "You must have enough room on your hard drive for the file that MakeAB creates.")
                                (range 1 max_size)
                                (default def_size)
                            )
                        )
                    )
                )
                ; now to create the makeab partition.
                (textfile
                    (dest "t:makeab_params")
                    (append ("%ld\n%ld\n%ld\ny\n" heads sectors cylinders))
                )
                (set abfile (askstring
                        (prompt ("Enter the filename for your AutoBoot virtual drive.\nThe default name is\"DriveC.\" The Path for the Directory in which the Autoboot Virtual Drive is located: %s" directory))
                        (help "This allows the user the ability to name the file that will be used as a AutoBoot Virtual Drive.")
                        (default "DriveC")
                    )
                )
                (if (= abfile "")
                    (set abfile "DriveC")
                )
                (set directory (tackon directory abfile))

                ; This routine deletes an existing makeab drive

                (if (exists ("%s" directory))
                    (

                        (protect ("%s" directory) "+d")
                        (delete ("%s" directory)
                            (prompt ("WARNING!\nThe file \"%s\" is present. If you continue the install will destroy an existing AutoBoot Virtual Drive." directory))
                            (help "This will delete an existing AutoBoot Virtual Drive. If you do not wish do this then select ...")
                            (confirm)
                        )
                    )
                )
                (if (NOT (exists ("%s" directory)))
                    (
                        (message ("The Install program will now create an AutoBoot virtual drive %s" directory))
                        (working
                            "Please wait!\n\nCreating the AutoBoot virtual drive."
                        )
                        (run ("makeab <t:makeab_params %s" directory))
                        (delete "t:makeab_params")
                        (if (= (askbool
                                    (prompt "Do you want your AutoBoot Virtual Drive protected from Deletion")
                                    (help "It is recommended that your AutoBoot Virtual Drive be protected from Deletion")
                                    (default 1)
                                )
                           1)
                            (
                                ; This deletes the "ed" flags from the Autoboot Virtual Drive
                                (protect ("%s" directory) 3)
                            )
                        )
                        ; Set up addbuffers
                        ; figure out the number of buffer
                        (set buffernum (* size 20))
                        (run ("AmigaJanus:c/MakeCommand >ENV:MAKEAB_PATH addbuffers %s %ld" directory buffernum))
                        (set buffer (getenv "MAKEAB_PATH"))
                        (if (= (askbool
                                    (prompt ("The default value for AddBuffers is 20 buffers for each MegaByte of the AutoBoot virtual drive do you wish to use the default?\nThis will use approximately %ldK of Amiga memory." (/ (/ (* buffernum 560) 1024) 10)))
                                    (help "Addbuffers increases the speed of access by the bridgeboard to an AutoBoot Virtual Drive. Be advised that the larger your addbuffers is the more memory that you use.")
                                    (default 1)
                                    )
                            1)
                            (
                                (startup "AmigaJanus ADDBUFFERS"
                                    (prompt ("Installing the \"%s\" command to S:User-Startup\nThis will use %ldK of Amiga memory." buffer (/ (/ (* buffernum 560) 1024) 10)))
                                    (help "ADDBUFFERS speeds up access to the AutoBoot virtual drive")
                                    (command ("%s" buffer))
                                )
                            )
                            (
                                (set buffernum (asknumber
                                        (prompt "Enter the number of buffers that you wish to add to your partition")
                                        (help "ADDBUFFERS speeds up access to the AutoBoot virtual drive")
                                    )
                                )
                                (if (NOT (= buffernum 0))
                                    (
                                        (run ("AmigaJanus:c/MakeCommand >ENV:MAKEAB_PATH addbuffers %s %ld" directory buffernum))
                                        (startup "AmigaJanus ADDBUFFERS"
                                            (prompt ("Installing the \"%s\" command to S:User-Startup\nThis will use approximately %ldK of Amiga memory." buffer (/ (/ (* buffernum 560) 1024) 10)))
                                            (help "ADDBUFFERS speeds up access to the AutoBoot virtual drive")
                                            (command ("%s" buffer))
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
        ; DJMount option
        (if (= (IN optionmask 1) 2)
            (
                (set choice1 (askchoice
                        (prompt "The Install procedure will now place the DJMount command in your S:User-Startup\n\nWhat File system do you wish to use on your DJMount device?")
                        (help "DJMount is used to allow a user to use part of a PCHard disk as an Amiga Partition.\n\nThis part of the install will place the proper command in the S:User-Startup.\n\n The user will still have to run ADisk on the PC Side and then format the partition as described in the Manual")
                        (choices    "Fast File System"
                                    "Old File System"
                        )
                        (default 0)
                    )
                )
                (if (= choice1 0)
                    (
                        (startup "AmigaJanus DJMount"
                            (prompt "Installing the \"DJMount FFS\" Command into S:UserStartup")
                            (help "This is required if you want to use the Fast File System on the Amiga Partition of your PC Hard Disk Drive.")
                            (command "DJMount FFS")
                        )
                    )
                    (
                        (startup "AmigaJanus DJMount"
                            (prompt "Installing the \"DJMount\" Command into S:UserStartup")
                            (help "This is required if you want to use an Amiga Partition of your PC Hard Disk Drive.")
                            (command "DJMount")
                        )
                    )
                )
            )
        )
        ; Install Flipper to run at boot.

        (if (AND (= (IN optionmask 3) 8) (= bbtype 0))
            (
                (set choice2 (askchoice
                        (prompt "Do you want Flipper to Run in Auto or Man mode?")
                        (help "If Flipper is run in Auto mode it will automatically attempt to detect what type of disk is inserted into the Shared Amiga Drive.\nIf Flipper is launched in Man mode. The user will have to select whether the Shared Amiga Drive is a PC Drive or an Amiga Drive.")
                        (choices    "AUTO Mode"
                                    "MAN Mode"
                        )
                        (default 0)
                    )
                )
                (if (= choice2 0)
                    (
                        (startup "AmigaJanus Flipper"
                            (prompt "Installing the \"Flipper AUTO\" command into S:User-Startup")
                            (help "Installing the \"Flipper AUTO\" command into S:User-Startup launches Flipper. Flipper will only run if your PCPrefs is set to have an Amiga Shared Drive. See your manual for more information")
                            (command "run >nil: sys:pc/Flipper auto")
                        )
                    (run "run >nil: sys:pc/flipper auto")
                    )
                    (
                        (startup "AmigaJanus Flipper"
                            (prompt "Installing the \"Flipper MAN\" command into S:User-Startup")
                            (help "Installing the \"Flipper MAN\" command into S:User-Startup launches Flipper. Flipper will only run if your PCPrefs is set to have an Amiga Shared Drive. See your manual for more information")
                            (command "run >nil: sys:pc/Flipper man")
                        )
                    (run "run >nil: sys:pc/flipper man")
                    )
                )
            )
        )
        ; Install PCWindow at boot.
        (if (= (IN optionmask 4) 16)
            (
                (set choice3 (askchoice
                        (prompt "Do you want PC COLOR or PC MONO to be run a boot time?")
                        (help "PCPrefs or you BridgeBoard hardware must be set to whichever default mode that you choose. Otherwise the display may not function properly.")
                        (choices    "PC COLOR"
                                    "PC MONO"
                        )
                        (default 0)
                    )
                )
                (if (= choice3 0)
                    (
                        (startup "AmigaJanus PC COLOR"
                            (prompt "Installing the \"PC COLOR\" Command into S:User-Startup")
                            (help "This will install the command \"run >nil: sys:pc/pcwindow color\" into you S:User-Startup")
                            (command "run >nil: sys:pc/pcwindow color")
                        )
                    )
                    (
                        (startup "AmigaJanus PC MONO"
                            (prompt "Installing the \"PC MONO\" Command into S:User-Startup")
                            (help "This will install the command \"run >nil: sys:pc/pcwindow MONO\" into you S:User-Startup")
                            (command "run >nil: sys:pc/pcwindow MONO")
                        )
                    )
                )
            )
        )
        ; Install LPT1 or LPT1X at boot.
        (if (AND (= (IN optionmask 5) 32) (<= bbtype 0))
            (
                (set choice4 (askchoice
                        (prompt "Do you want to install LPT1 or LPT1X")
                        (help "LPT1X - A program which connects the Bridgeboards LPT1: emulation hardware to the Amiga's printer.device. This differs from LPT1 in that you can redirect it to the Amiga's parallel or serial ports. You can also use CMD on other device output interceptors to capture the output to an Amiga file.\n\n"
                            "LPT1 - A program which connects the Bridgeboards LPT1: emulation hardware to the Amiga's parallel port."
                        )
                        (choices    "LPT1X"
                                    "LPT1"
                        )
                        (default 0)
                    )
                )
                (if (= choice4 0)
                    (
                        (startup "AmigaJanus LPT1X"
                            (prompt "Installing the \"LPT1X\" command into S:User-Startup")
                            (help "This will install the LPT1X command allowing the user to allocate the printer for use by the Bridgeboard.")
                            (command "run >nil: sys:pc/lpt1x")
                        )
                    )
                    (
                        (startup "AmigaJanus LPT1"
                            (prompt "Installing the \"LPT1\" command into S:User-Startup")
                            (help "This will install the LPT1 command allowing the user to allocate the printer for use by the Bridgeboard.")
                            (command "run >nil: sys:pc/lpt1")
                        )
                    )
                )
            )
        )
        ; Install Enforcer or CPU at boot.
        (if (= (IN optionmask 6) 64)
            (
                (if (AND (> cpu 1) (< ver 36))
                    (set cpuenf 2)
                    (set cpuenf 0)
                )
                (set choice5 (askchoice
                        (prompt ("Do you want to install Enforcer or CPU\nSee \"Help\" for information on each\n\nThe Install will rename your %sS/Startup-Sequence to %sS/Startup-Sequence.bak if there are problems with the install rename %sS/Startup-Sequence.bak to %sS/Startup-Sequence. For information on rename, see your AmigaDOS reference." bootpart bootpart bootpart bootpart))
                        (help "ENFORCER - Enforcer keeps the Bridgeboard's Dual Ported RAM from being cached by the 680X0 Microprocessor.\n\nCPU turns all datacaching by the 680X0 Microprocessor OFF. This will slow down the entire system. CPU is a 2.0 compatible program, it cannot be used under the 1.3 operating system. It is recommended that you install ENFORCER for better system performance\n"
                              "SetCPU turns all datacaching by the 680X0 Microprocessor OFF. This will slow down the entire system. SetCPU is a 1.3 compatible program, it cannot be used under the 2.0 operating system. It is recommended that you install ENFORCER for better system performance\n"
                        )
                        (choices    "ENFORCER"
                                    "CPU"
                                    "SetCPU"
                        )
                        (default cpuenf)
                    )
                )
                (if (= choice5 0)
                    (
                        (rename
                            ("%sS/Startup-Sequence" bootpart) ("%sS/Startup-Sequence.BAK" bootpart)
                            (prompt ("Creating %sS/Startup-Sequence.BAK" bootpart))
                            (help ("This creates a file %sS/Startup-Sequence.BAK that will be placed in the S: Directory of your boot partition. This is provided in case there is some trouble with the install. If you have problems booting your machine, rename %sS/Startup-Sequence.BAK to %sS/Startup-Sequence and reboot your Amiga. You can then try to reinstall the BridgeBoard software." bootpart bootpart bootpart))
                        )
;                        (copyfiles
;                            (prompt ("Creating %sS/Startup-Sequence.BAK" bootpart))
;                            (help ("This creates a file %sS/Startup-Sequence.BAK that will be placed in the S: Directory of your boot partition. This is provided in case there is some trouble with the install. If you have problems booting your machine, rename %sS/Startup-Sequence.BAK to %sS/Startup-Sequence and reboot your Amiga. You can then try to reinstall the BridgeBoard software." bootpart bootpart bootpart))
;                            (source ("%sS/Startup-Sequence" bootpart))
;                            (dest ("%sS" bootpart))
;                            (newname ("%sS/Startup-Sequence.BAK" bootpart))
;                            (files)
;                        )
                        (delete "%sS/Startup-Sequence")
                        (run ("AmigaJanus:c/insertline %sS/Startup-Sequence.BAK %sS/Startup-Sequence BindDrivers \"Sys:Tools/Enforcer >nil: quiet\"" bootpart bootpart))
                        (if (NOT (exists ("%sTools/Enforcer" bootpart)))
                            (copyfiles
                                (source "AmigaJanus:c/Enforcer")
                                (dest ("%sTools" bootpart))
                                (files)
                            )
                        )
                    )
                )
                (if (AND (= choice5 1) (>= ver 36))
                    (
                        (rename
                            ("%sS/Startup-Sequence" bootpart) ("%sS/Startup-Sequence.BAK" bootpart)
                            (prompt ("Creating %sS/Startup-Sequence.BAK" bootpart))
                            (help ("This creates a file %sS/Startup-Sequence.BAK that will be placed in the S: Directory of your boot partition. This is provided in case there is some trouble with the install. If you have problems booting your machine, rename %sS/Startup-Sequence.BAK to %sS/Startup-Sequence and reboot your Amiga. You can then try to reinstall the BridgeBoard software." bootpart bootpart bootpart))
                        )
;                        (copyfiles
;                            (prompt ("Creating %sS/Startup-Sequence.BAK" bootpart))
;                            (help ("This creates a file %sS/Startup-Sequence.BAK that will be placed in the S: Directory. This is provided in case there is some trouble with the install. If your have problems booting your machine, rename %sS/Startup-Sequence.BAK to %sS/Startup-Sequence and reboot your Amiga. You can then try to reinstall the BridgeBoard software." bootpart bootpart bootpart))
;                            (source ("%sS/Startup-Sequence" bootpart))
;                            (dest ("%sS" bootpart))
;                            (newname ("%sS/Startup-Sequence.BAK" bootpart))
;                            (files)
;                        )
                        (delete ("%sS/Startup-Sequence" bootpart))
                        (run ("AmigaJanus:c/insertline %sS/Startup-Sequence.BAK %sS/Startup-Sequence BindDrivers \"CPU NODATACACHE\"" bootpart bootpart))
                        (if (NOT (exists "C:CPU"))
                            (copyfiles
                                (source "AmigaJanus:c/CPU")
                                (dest ("%sC" bootpart))
                                (files)
                            )
                        )
                    )
                )
                (if (AND (= choice5 2) (< ver 36))
                    (
                        (rename
                            ("%sS/Startup-Sequence" bootpart) ("%sS/Startup-Sequence.BAK" bootpart)
                            (prompt ("Creating %sS/Startup-Sequence.BAK" bootpart))
                            (help ("This creates a file %sS/Startup-Sequence.BAK that will be placed in the S: Directory of your boot partition. This is provided in case there is some trouble with the install. If you have problems booting your machine, rename %sS/Startup-Sequence.BAK to %sS/Startup-Sequence and reboot your Amiga. You can then try to reinstall the BridgeBoard software." bootpart bootpart bootpart))
                        )
;                        (copyfiles
;                            (prompt ("Creating %sS/Startup-Sequence.BAK" bootpart))
;                            (help ("This creates a file %sS/Startup-Sequence.BAK that will be placed in the S: Directory. This is provided in case there is some trouble with the install. If your have problems booting your machine, rename %sS/Startup-Sequence.BAK to %sS/Startup-Sequence and reboot your Amiga. You can then try to reinstall the BridgeBoard software." bootpart bootpart bootpart))
;                            (source ("%sS/Startup-Sequence" bootpart))
;                            (dest ("%sS:" bootpart))
;                            (newname ("%sS/Startup-Sequence.BAK" bootpart))
;                            (files)
;                        )
                        (delete ("%sS/Startup-Sequence" bootpart))
                        (run ("AmigaJanus:c/insertline %sS/Startup-Sequence.BAK %sS/Startup-Sequence BindDrivers \"SetCPU NODATACACHE\"" bootpart bootpart))
                        (if (NOT (exists "C:SetCPU"))
                            (set setcpudir (askdir
                                    (prompt ("The Install is unable to locate SetCPU in your %sC directory. Please select the directory where you keep the SetCPU command. The Install will then copy the SetCPU command to your %sC directory" bootpart bootpart))
                                    (help "Need to do the help for this.")
                                    (default ("%sC" bootpart))
                                )
                            )
                            (copyfiles
                                (source ("%s" setcpudir))
                                (dest ("%sC" bootpart))
                                (files)
                            )
                        )
                    )
                )
            )
        )
        ; run the PCPrefs Option

        (if (AND (= (IN optionmask 2) 4) (<= bbtype 1))
            (
                ; make janus.library active.
                (run "search >t:controller t:config.file 513")
                (set isbbd (getsize "t:controller"))
                (if (> isbbd 0)
                    (
                        (run "c:binddrivers")
                        (run "sys:pc/pcprefs")
                    )
                    (
                        (message "The Bridgeboard hardware is not present, Please install the hardware to use this option.")
                    )
                )
            )
        )
; Clean up t:

(if (exists "t:config.file")
    (delete "t:config.file")
)
(if (exists "t:controller")
    (delete "t:controller")
)
(if (exists "t:enf.search")
    (delete "t:enf.search")
)
(if (exists "t:cpu.search")
    (delete "t:cpu.search")
)
(if (exists "t:flip.search")
    (delete "t:flip.search")
)
(if (exists "t:setcpu.search")
    (delete "t:setcpu.search")
)
(run "delete t:bbd? quiet")

; Need to assign T: back to where it started
(makeassign "T" ("%s" gett))
