FAILAT 21 
sys:c/sysvars
IF NOT $UAEMAJOR GT 0
   VERSION brcm-emmc.device >nil: 
   IF NOT FAIL 
      IF $FIRSTTIMEBOOT EQ "TRUE"
         ECHO >NIL: "Setting environment as Raspberry Pi 4 (or CM4)"
      ENDIF
      SETENV System "PiStorm"
      SETENV RpiType "RPi4"
      SYS:C/EMU68INFO variant >ENV:PistormVariant
   ELSE
      VERSION brcm-sdhc.device >NIL:
      IF NOT fail 
         IF $FIRSTTIMEBOOT EQ "TRUE"
            ECHO >NIL: "Setting environment as Raspberry Pi 3 (or Zero2)" 
         ENDIF
         SETENV System "PiStorm"
         SETENV RpiType "RPi3"
         SYS:C/EMU68INFO variant >ENV:PistormVariant
      ENDIF
   ENDIF
ELSE
   SETENV SYSTEM "UAE"
ENDIF 
IF $KICKVER EQ 47
   SETENV KickstartVersion 3.2
ELSE
   VERSION Workbench.Library 45 >NIL:
   IF not warn 
      SETENV KickstartVersion 3.9
   ELSE
      VERSION exec.library VERSION 40 >NIL:
      IF not warn
         SETENV KickstartVersion 3.1
      ENDIF
   ENDIF
ENDIF
c:ce >NIL: S:OneTimeRun 
IF WARN 
	ECHO >NIL: "Running One Time Scripts" 
	ECHO >T:RunTimeScript "FAILAT 21" 
	IF $SYSTEM EQ "UAE"
		LIST >>T:RunTimeScript S:OneTimeRun PAT=~(#?.info|#?_pistorm) LFORMAT="Execute *"%p%n*" >NIL:*nDelete *"%p%n*" >NIL:*n" ALL FILES
	ELSE
		LIST >>T:RunTimeScript S:OneTimeRun PAT=~(#?.info|) LFORMAT="Execute *"%p%n*" >NIL:*nDelete *"%p%n*" >NIL:*n" ALL FILES
	ENDIF
	EXECUTE T:RunTimeScript
	DELETE >NIL: T:RunTimeScript 
ENDIF 

IF $FIRSTTIMEBOOT EQ "TRUE"
	IF NOT $SYSTEM EQ "UAE"
		ECHO "FALSE" > SYS:PREFS/ENV-ARCHIVE/FIRSTTIMEBOOT
	ENDIF
ENDIF
IF $REBOOT EQ "TRUE" 
	ECHO "FALSE" > SYS:PREFS/ENV-ARCHIVE/REBOOT
	ECHO >NIL: "The Amiga will REBOOT in 3 seconds!"
	DISKCHANGE SDH0:
	WAIT 3
	REBOOT 
ENDIF
FAILAT 10