Perforce-AllSpice-Integration/AllSpice Setup.bat

70 lines
2.3 KiB
Batchfile

:: Version 1.1.0
@echo off
echo.
echo AllSpice Setup Installer for Meta Reality Labs
echo ----------------------------------------------
echo - Creating AllSpice directory at C:\allspice
:: Create the AllSpice directory if it doesn't exist
if not exist C:\allspice mkdir C:\allspice
:: Create tmp, log, util, and Perforce directories
if not exist C:\allspice\tmp mkdir C:\allspice\tmp
if not exist C:\allspice\log mkdir C:\allspice\log
if not exist C:\allspice\util mkdir C:\allspice\util
if not exist C:\allspice\perforce mkdir C:\allspice\perforce
:: Get date and time
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set allspice_log_date=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set allspice_log_time=%%a%%b)
echo - Installing git
:: Install git
choco install git -y
echo - Installing curl
:: Install curl
choco install curl -y
echo - Setting up allspice utilities
:: Add python Scripts directory to path
setx path "%path%;C:\tools\fb-python\fb-python312\Scripts;"
:: Install pip from source
curl -o C:\allspice\util\get-pip.py https://bootstrap.pypa.io/get-pip.py
C:\tools\fb-python\fb-python312\python.exe C:\allspice\util\get-pip.py
:: Install pip requests
C:\tools\fb-python\fb-python312\Scripts\pip.exe install requests
echo - Fetching the Perforce integration script
:: Download the Perforce integration script
curl -o C:\allspice\push_to_allspice_windows.py https://hub.allspice.io/AllSpice-Demos/Perforce-AllSpice-Integration/raw/branch/main/push_to_allspice_windows.py
echo - Installing Perforce custom tool into P4V
:: Download the Perforce custom tool
curl -o C:\Users\%USERNAME%\.p4qt\customtools.xml https://hub.allspice.io/AllSpice-Demos/Perforce-AllSpice-Integration/raw/branch/main/util/customtools.xml
:: Prompt user for their email
echo.
echo.
echo ----------
set /p "allspice_email_id=> Please enter your email: "
echo ----------
echo.
echo - Generating SSH key
:: Generate SSH key
ssh-keygen -t ed25519 -C "%allspice_email_id%"
:: Delete existing known hosts
del C:\Users\%USERNAME%\.ssh\known_hosts
:: Add AllSpice RL to known hosts
ssh-keyscan realitylabs.allspice.io > C:\Users\%USERNAME%\.ssh\known_hosts
echo - Copying SSH key to C:\allspice
:: Copy SSH key to AllSpice directory
copy C:\Users\%USERNAME%\.ssh\id_ed25519.pub C:\allspice\sshkey.txt
echo.
echo ----------------------------------------------
echo Finished!