; This script shows why Commodore's Installer was written
; - it's just a pity we can't rely on it being there! SNG

; $VER: Speculator Installer 1.04 18-Jan-1997

echo ""
echo "Installer for Amiga SPECULATOR v1.04"
echo ""

version version 39
if WARN
  echo ""
  echo "  Sorry - this script requires Workbench 3 or later."
  echo "  Please read the instructions and install manually."
  wait 8
  endcli
endif

echo ""
requestfile title "Where will Speculator go?" drawersonly drawer dh1: >env:zx
if WARN
  echo "  Cancelled."
  delete env:zx quiet
  wait 2
  endcli
endif

; Copy files with status report

echo "  Copying files to " noline
echo $zx noline
echo ""
echo $zx noline >env:zx2 ; New name ZX2 has suffix instead of newline
echo Speculator/ >>env:zx2
copy /Speculator/#? to "$zx2" all clone
if WARN
  echo ""
  echo "  Installation aborted!"
  delete "$zx2" all quiet force
  delete env:zx quiet
  delete env:zx2 quiet
  wait 5
  endcli
endif

; Copy icon for system

copy prefs/#? sys:prefs/ all

; Adjust user-startup

copy s:user-startup to s:user-startup.preZX ;Backup copy
Assign Speculator: "$zx2"
echo ";BEGIN Speculator 97" >>s:user-startup
echo "assign Speculator: " >>s:user-startup NOLINE
echo $zx2 >>s:user-startup
echo "path Speculator:Utilities add" >>s:user-startup
; POINTLESS HERE! path Speculator:Utilities add
echo ";END Speculator 97" >>s:user-startup

; Install handler if required

RequestChoice >env:mgt "MGT Spectrum & SAM disk handler" "Select drives to use MGT disk hander" "SP0:|SP1:|BOTH|NONE"

if $mgt EQ 0
  skip QUIT
endif

echo ""
copy MGT-Handler/l/#? L:

if not $mgt EQ 2
  echo "  Mounting SP0: handler"
  copy MGT-Handler/Storage/SP0#? to DEVS:DosDrivers/
  mount SP0:
endif

if not $mgt EQ 1
  echo "  Mounting SP1: handler"
  COPY MGT-Handler/Storage/SP1#? TO DEVS:DosDrivers/
  mount SP1:
endif

LAB QUIT

echo ""
echo "  SPECULATOR is now installed in:" $zx2

delete env:mgt quiet
delete env:zx2 quiet
delete env:zx quiet

wait 4
endcli

