@echo off
REM Kraken Player - one-double-click appliance installer.
REM The customer double-clicks THIS file. It self-elevates (one native UAC
REM prompt), then runs install.ps1 in the same folder to set up the box as a
REM self-running signage appliance in the Windows account already signed in
REM (Defender exclusion, autostart, fullscreen lockdown, pre-placed ffmpeg).
REM It does not create or switch to a separate Kraken Windows account.
REM
REM On first download Windows SmartScreen may show "Windows protected your PC"
REM for this unsigned file: click "More info" -> "Run anyway" (one time).

setlocal
set "SCRIPT_DIR=%~dp0"

REM Already elevated? (fltmc only succeeds with admin rights.)
fltmc >nul 2>&1
if %errorlevel% equ 0 goto :run

REM Not elevated - relaunch this .cmd elevated via a single UAC prompt.
echo Requesting administrator permission...
powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b

:run
echo Installing Kraken Player appliance...
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%install.ps1" %*
set "RC=%errorlevel%"
if not "%RC%"=="0" (
  echo.
  echo Installation reported an error ^(code %RC%^). See the messages above.
  echo.
  pause
)
endlocal
