Skip to content

Commit

Permalink
Add automated installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
keton committed Feb 26, 2024
1 parent 2cea1d7 commit 47377ee
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions pd-install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env pwsh

# Usage:
# save on desktop
# Win + R
# powershell -ExecutionPolicy Bypass -File %UserProfile%\Desktop\pd-install.ps1

# Stop executing script on any error
$ErrorActionPreference = 'Stop'
# Do not show download progress
$ProgressPreference = 'SilentlyContinue'

# Taken from https://stackoverflow.com/a/34559554/6537420
function New-TemporaryDirectory {
$parent = [System.IO.Path]::GetTempPath()
[string] $name = [System.Guid]::NewGuid()
New-Item -ItemType Directory -Path (Join-Path $parent $name)
}

function Format-Parameters {
Param ([hashtable]$NamedParameters)
return ($NamedParameters.GetEnumerator() | ForEach-Object { "-$($_.Key) `"$($_.Value)`"" }) -join " "
}

# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-ExecutionPolicy Bypass -File `"" + $MyInvocation.MyCommand.Path + "`" " + (Format-Parameters $MyInvocation.BoundParameters) + " " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}

# Remainder of script here

$tempFileFolder = New-TemporaryDirectory

Write-Output "Temporary dir: $tempFileFolder"

Write-Output "Creating necessary folders"
mkdir "$env:APPDATA\UnrealVRMod\PenDriverPro-Win64-Shipping" -Force
mkdir "$env:APPDATA\raicuparta\rai-pal\data\mod-loaders\runnable\mods\chihuahua" -Force

Write-Output "Adding Windows Defender exceptions"
Add-MpPreference -ExclusionPath "$env:APPDATA\UnrealVRMod" -Force
Add-MpPreference -ExclusionPath "$env:APPDATA\raicuparta\rai-pal\data\mod-loaders\runnable" -Force

Write-Output "Downloading Rai Pal"
Invoke-WebRequest https://github.com/Raicuparta/rai-pal/releases/latest/download/RaiPal.msi -OutFile "$tempFileFolder/RaiPal.msi"

Write-Output "Downloading Chihuahua"
Invoke-WebRequest https://github.com/keton/chihuahua/releases/latest/download/chihuahua.zip -OutFile "$tempFileFolder/chihuahua.zip"

Write-Output "Downloading Pacific Drive profile"
Invoke-WebRequest https://github.com/keton/pacific-drive-uevr/releases/latest/download/PenDriverPro-Win64-Shipping.zip -OutFile "$tempFileFolder/PenDriverPro-Win64-Shipping.zip"

Write-Output "Installing Rai Pal"
Start-Process -NoNewWindow -Wait msiexec -ArgumentList /i, "$tempFileFolder\RaiPal.msi", /qn

Write-Output "Installing chihuahua"
Expand-Archive -LiteralPath "$tempFileFolder/chihuahua.zip" -DestinationPath "$env:APPDATA\raicuparta\rai-pal\data\mod-loaders\runnable\mods\chihuahua" -Force

Write-Output "Setting chihuahua to pull UEVR nightlies"
(Get-Content "$env:APPDATA\raicuparta\rai-pal\data\mod-loaders\runnable\mods\chihuahua\rai-pal-manifest.json").Replace('"--delay"', '"--uevr-build","Nightly","--delay"') | Set-Content "$env:APPDATA\raicuparta\rai-pal\data\mod-loaders\runnable\mods\chihuahua\rai-pal-manifest.json"

Write-Output "Installing Pacific Drive profile"
Expand-Archive -LiteralPath "$tempFileFolder/PenDriverPro-Win64-Shipping.zip" -DestinationPath "$env:APPDATA\UnrealVRMod\PenDriverPro-Win64-Shipping" -Force

Write-Output "Cleaning up"
Remove-Item -Force -Recurse "$tempFileFolder"

Write-Host "Press any key to continue..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

0 comments on commit 47377ee

Please sign in to comment.