.KEY drive

; AmigaDOS Shell script for creating a minimal Workbench disk, needs
; about 300K of free memory to execute.
; by Alex Matulich 10 June 1995

; The disk created by this script is usually bigger than needed, but as it
; is, it should be useful for most any purpose.

; INSTRUCTIONS:
; 1) This script assumes you're using a copy of your Commodore standard-
;    issue Workbench disk (it can have optional extras on it like
;    req.library or the "ls" command).  Make a backup copy if you haven't
;    done so yet.
; 2) Copy this file (MakeWB) to the S: directory of your Workbench copy.
; 3) Boot up with this copy of your standard-issue Workbench disk.
; 4) Open the Workbench icon and click twice on the "Shell" icon.
; 5) Type:  s:MakeWB <drive>
;           (where <drive> is df0: or df1: or fd0: or wherever your
;           Workbench disk was just booted from)
; 6) The MakeWB script will then create an image of a minimal disk in RAM:
;    and after it's done, you will be prompted to insert a formatted blank
;    disk in your boot drive.  The blank disk will become your minimal
;    Workbench boot disk.


; first, we resident some commands for efficiency and check syntax

failat 21
if exists <drive>c/if
   resident <drive>c/if pure
   resident <drive>c/else pure
   resident <drive>c/endif pure
endif
if exists <drive>c/echo
   resident <drive>c/echo pure
endif

failat 20
echo "*e[H*e[2J*e[0;33;40m*nMAKE A MINIMAL WORKBENCH DISK.*e[0;31;40m*n"
if <drive> EQ ""
   echo "YOU MUST SPECIFY A DRIVE NAME, FOR EXAMPLE:"
   echo "MakeWB df0:"
   quit
endif

echo "Please put your WRITE-PROTECTED standard Workbench floppy boot disk*nin drive <drive>."
ask "Press the RETURN key when ready."

resident <drive>c/copy pure
resident <drive>c/makedir pure

; make necessary system directories

makedir ram:tempwb
assign tempwb: ram:tempwb

echo "*nMaking necessary system directories in ram:"
makedir tempwb:c      ; commands go here
makedir tempwb:l      ; handlers go here
makedir tempwb:s      ; startup-sequence goes here
makedir tempwb:t      ; temp directory - used during boot-up
makedir tempwb:libs   ; libraries go here
makedir tempwb:devs   ; devices and system-configuration go here
makedir tempwb:fonts  ; this will remain empty unless you copy a font to it
makedir tempwb:system ; system utilities go here
makedir tempwb:utilities ;empty
makedir tempwb:prefs     ;empty
if exists <drive>devs/DOSDrivers
   makedir tempwb:devs/DOSDrivers
endif
if exists <drive>rexx
   makedir tempwb:rexx
endif
if exists <drive>locale
   makedir tempwb:locale
endif

copy <drive>c/Install ram:          ; needed later
copy <drive>c/Info ram:             ; needed later

; copy mandatory commands to the c directory

echo "Copying necessary commands..."
copy <drive>c/Addbuffers  tempwb:c  ; used in startup-sequence (optional)
copy <drive>c/Assign      tempwb:c  ; used in startup-sequence for assigning ram dirs
copy <drive>c/BindDrivers tempwb:c  ; required in startup
if exists <drive>c/Break
   copy <drive>c/Break    tempwb:c  ; required in startup
endif
if exists <drive>c/CD
   copy <drive>c/CD       tempwb:c  ; very necessary for CLI use
endif
copy <drive>c/Copy        tempwb:c  ; often needed for CLI use
if exists <drive>c/echo
   copy <drive>c/echo     tempwb:c  ; needed by startup-sequence
endif
if exists <drive>c/EndCLI
   copy <drive>c/EndCLI   tempwb:c  ; needed to close startup window
endif
copy <drive>c/Execute     tempwb:c  ; needed for Shell and other things
if exists <drive>c/FF
   copy <drive>c/FF       tempwb:c  ; required for faster text
endif
if exists <drive>c/FailAt
   copy <drive>c/FailAt   tempwb:c  ; needed in startup-sequence
endif
if exists <drive>c/Mount
   copy <drive>c/Mount    tempwb:c  ; needed by startup-sequence
endif
if exists <drive>c/Path
   copy <drive>c/Path     tempwb:c  ; needed for Workbench and subsequent CLI's
endif
if exists <drive>c/Prompt
   copy <drive>c/Prompt   tempwb:c  ; required by Shell-Startup
endif
if exists <drive>c/Resident
   copy <drive>c/Resident tempwb:c  ; needed by startup-sequence
endif
if exists <drive>c/Run
   copy <drive>c/Run      tempwb:c  ; needed by startup & other software
endif
copy <drive>c/SetPatch    tempwb:c  ; needed to fix bugs
if exists <drive>c/SetClock
   copy <drive>c/Setclock tempwb:c  ; needed in startup-sequence
endif
if exists <drive>c/Wait
   copy <drive>c/Wait     tempwb:c  ; needed in startup-sequence
endif

; copy your favorite useful commands to the c directory

echo "Copying other useful commands..."
copy <drive>c/Delete      tempwb:c  ; often needed for CLI use
if exists <drive>c/ls
   copy <drive>c/ls       tempwb:c  ; DIR replacement necessary for CLI use
else
   if exists <drive>c/Dir
      copy <drive>c/Dir   tempwb:c  ; very neccessary for CLI use
   endif
endif
copy <drive>c/LoadWB      tempwb:c  ; Delete this if you only want a CLI environment
copy <drive>c/Makedir     tempwb:c  ; used in startup-sequence for making ram dirs
if exists <drive>Shell
   copy <drive>Shell#?    tempwb: quiet
else
   if exists <drive>system/Shell
      copy <drive>system/Shell#? tempwb: quiet
   endif
endif
if exists <drive>system/CLI
   copy <drive>system/CLI#? tempwb:system quiet   ; needed for 1.3 Shell
;   if exists <drive>c/NewCLI
;      copy <drive>c/NewCLI tempwb:c  ; needed for creating new CLI windows
;   endif
endif
if exists <drive>system/more
   copy <drive>system/More tempwb:c
endif
if exists <drive>c/IconX
   copy <drive>c/Iconx tempwb:c
endif
if exists <drive>c/NewShell
   copy <drive>c/NewShell tempwb:c
endif
copy <drive>c/Rename      tempwb:c  ; often needed for CLI use
if exists <drive>system/SetMap
   copy <drive>system/SetMap tempwb:system  ; needed for keyboard settings
endif
if exists <drive>c/Stack
   copy <drive>c/Stack    tempwb:c  ; used in startup-sequence
endif
copy <drive>c/Type        tempwb:c  ; nice to have for CLI use
if exists <drive>system/FastMemFirst
   copy <drive>system/FastMemFirst tempwb:System  ; used in startup-sequence (optional)
endif

; copy necessary handlers

echo "Copying necessary handlers..."
if exists <drive>l/Disk-Validator
   copy <drive>l/Disk-Validator tempwb:l  ; needed when inserting a new disk
endif
if exists <drive>l/RAM-Handler
   copy <drive>l/RAM-Handler tempwb:l  ; this is required for the ramdisk
endif
copy <drive>l/Port-Handler   tempwb:l  ; unnecessary if you don't use I/O ports
if exists <drive>l/Shell-Seg
   copy <drive>l/Shell-Seg   tempwb:l  ; needed for WB 1.3 Shell
endif
if exists <drive>l/Newcon-handler
   copy <drive>l/Newcon-handler tempwb:l ; needed for NewShell
endif

; copy libraries (may be unnecessary depending on your application)

echo "Copying libraries..."
; copy <drive>libs/mathtrans.library tempwb:libs ; needed for transcendental functions
if exists <drive>libs/icon.library
   copy <drive>libs/icon.library  tempwb:libs  ; required for Workbench to load
endif
if exists <drive>libs/info.library
   copy <drive>libs/info.library  tempwb:libs  ; WB "info" function - nice to have
endif
if exists <drive>libs/asl.library
   copy <drive>/libs/asl.library tempwb:libs
else
   if exists <drive>libs/req.library
      copy <drive>libs/req.library tempwb:libs ; file requester, nice to have
   endif
endif
if exists <drive>libs/iffparse.library
   copy <drive>libs/iffparse.library tempwb:libs
endif
copy <drive>libs/version.library tempwb:libs   ; sometimes needed, and small
copy <drive>libs/diskfont.library tempwb:libs  ; often needed by software (you might
                                            ; need a font in the fonts dir too)
; set up devices directory

echo "Setting up devs directory..."
makedir tempwb:devs/keymaps
makedir tempwb:devs/printers
if exists <drive>devs/keymaps/usa1
   copy <drive>devs/keymaps/usa1 tempwb:devs/keymaps   ; needed for A2000/A500 keybd
endif
copy <drive>devs/MountList   tempwb:devs
copy <drive>devs/printers/#? tempwb:devs/printers quiet ; your printer driver goes here
copy <drive>devs/clipboard.device tempwb:devs ; USUALLY unnecessary but sometimes used
copy <drive>devs/parallel.device  tempwb:devs ; only needed if you use parallel port
copy <drive>devs/printer.device   tempwb:devs ; only needed if you use a printer
copy <drive>devs/serial.device    tempwb:devs ; only needed if you use serial port
copy <drive>devs/system-configuration tempwb:devs  ; prefs - required for boot-up

; now build the user's startup sequence in the s: directory

echo "Setting up s directory..."
copy <drive>s/startup-sequence tempwb:s
if exists <drive>s/startupII
   echo > tempwb:s/startupII "resident c:Resident pure"
   if exists tempwb:c/ls
      echo >> tempwb:s/startupII "resident c:ls pure"
   endif
   echo >> tempwb:s/startupII "resident c:CD pure*nresident c:assign pure*nresident c:MakeDir pure"
   echo >> tempwb:s/startupII "makedir ram:t*nmakedir ram:env*nmakedir ram:clipboards"
   echo >> tempwb:s/startupII "assign T: ram:t*nassign ENV: ram:env*nassign CLIPS: ram:clipboards"
   echo >> tempwb:s/startupII "resident Assign remove*nbreak 1 C"
endif
if exists <drive>s/dpat
   copy <drive>s/dpat     tempwb:s  ; needed for rename
endif
if exists <drive>s/Shell-Startup
   copy <drive>s/Shell-Startup tempwb:s
   if exists tempwb:c/ls
      echo >> tempwb:s/Shell-Startup "alias dir ls*nalias list ls -l"
   endif
endif

; now copy the ram image to a blank disk

echo "*nPlease REMOVE the original Workbench boot disk.*n*nPlace a FORMATTED blank disk in drive <drive>."
ask "Press the RETURN key when you are ready."

ram:install <drive>
ram:install > NIL: <drive> check
if WARN              ; condition is true if abnormal bootblock detected
   echo "(The bootblock isn't normal.  You may have a virus.*nPlease check it out sometime.)"
endif
tempwb:c/delete ram:install

echo "*ncopying ram: image to <drive> and cleaning up memory..."
tempwb:c/copy tempwb: <drive> all quiet
if NOT exists tempwb:libs/asl.library
   if NOT exists tempwb:libs/req.library
      echo "*nYou should install req.library to the libs directory."
   endif
endif
echo ""
ram:info <drive>
tempwb:c/delete ram:info
tempwb:c/assign tempwb:
ram:tempwb/c/delete ram:tempwb all quiet
echo "*nAll done!  Space available on <drive> is shown above."
