; ShareKIT - starts the ShareKIT built for this computer from the Amiga
; drawer beside this script.
;
; Double-clicked, IconX runs this in its own drawer; in a Shell, CD to
; this drawer first - started from elsewhere it says so.  No Stack here:
; each binary sees to its own, and this script runs in the caller's
; Shell, which would keep it.
FailAt 21
Assign >NIL: MOSSYS: EXISTS
If NOT WARN
  Set platform ShareKIT.mos
Else
  Version >NIL: exec.library VERSION 50
  If WARN
    Set platform ShareKIT.68k
  Else
    ; AmigaOS 4 and AROS both have exec 50 and up.  AROS's Version
    ; prints which CPU a file is built for; on AmigaOS 4 no such line
    ; appears and ShareKIT.os4 stays.
    Set platform ShareKIT.os4
    Version >T:ShareKITarch C:Version FILE ARCH
    Search >NIL: T:ShareKITarch X86-64
    If NOT WARN
      Set platform ShareKIT.aros-x86_64
    EndIf
    Search >NIL: T:ShareKITarch I386
    If NOT WARN
      Set platform ShareKIT.aros-i386
    EndIf
    Search >NIL: T:ShareKITarch M68k
    If NOT WARN
      Set platform ShareKIT.68k
    EndIf
    Delete >NIL: T:ShareKITarch QUIET
  EndIf
EndIf
If EXISTS "Amiga/$platform"
  "Amiga/$platform"
Else
  Echo "ShareKIT: start it with its icon, or from its own drawer."
EndIf
Unset platform
