.KEY ,
.BRA {
.KET }
;;$VER: Install 37.10 (6.7.93)
;;
;;  $Filename: Install $
;;  $Version: 37.10 $
;;  $Date: 6.7.93 $
;;  $Creation: 14.6.93 $
;;
;;  Script file to install rexxreqtools.library.
;;
;;   Copyright 1993 Rafael D'Halleweyn, all rights reserved
;;



FailAt 30

; Set stack for Installer
Stack 10000

;
; We need Kickstart 2.04 or higher
;
Version >NIL: VERSION 37
If WARN
  Echo "You need Kickstart 2.04 or higher to use RexxReqTools"
  Skip end
EndIf

;
; Macro
;
Set Install "Installer >NIL: *"Install RexxReqTools*" RexxReqTools"

;
; Can we find Installer?
;

; first: can we find Installer in the current path
$Install
If NOT ERROR
  Quit
EndIf

Version >NIL:     ; Get Workbench version in $Workbench

; clear error output 'Installer: Unknown command'
Echo "*E[0;0H*E[J*n" NOLINE

If $Workbench GE 41
  Echo "This must be a very old version of RexxReqTools."
  Skip end
EndIf

Echo "Searching for Installer..."
; I'd better be prepared
If $Workbench GE 40
  If EXISTS Install3.1:Installer
    Run >NIL: Install3.1:$Install
    Quit
  Else
    Skip byhand
  EndIf
EndIf

If $Workbench GE 39
  If EXISTS Install3.0:Installer
    Run >NIL: Install3.0:$Install
    Quit
  Else
    Skip byhand
  EndIf
EndIf

If $Workbench GE 38
  If EXISTS Install2.1:Installer
    Run >NIL: Install2.1:$Install
    Quit
  Else
    Skip byhand
  EndIf
EndIf


;
; Couldn't find Installer: I'll do it by hand.
;
Lab byhand

; Clever way to find version of included rexxreqtools.library
Version >ENV:RRTVersion{$$} "`cd`/rexxreqtools.library"
If FAIL
  Version >ENV:RRTVersion{$$} "`cd`rexxreqtools.library"
EndIf
Echo "*E[0;0H*E[J*n$RRTVersion{$$} Installation Script*n"

If EXISTS LIBS:rexxreqtools.library
  Echo "Version of rexxreqtools.library already installed:"
  Version LIBS:rexxreqtools.library
  Echo ""
EndIf

Ask "Install $RRTVersion{$$} ?"
If WARN
  Copy rexxreqtools.library LIBS:rexxreqtools.library
  Echo "*n$RRTVersion copied to your LIBS: directory.*n"

  Version >NIL: reqtools.library VERSION 38
  If WARN
    Echo "*nYou'll also need version 38 (or higher) of the reqtools.library!!*n"
  EndIf

  Echo "*nInstallation completed"
EndIf


Lab end

UnsetEnv RRTVersion{$$}
Wait 3

Quit
