102 lines
4.4 KiB
Smarty
102 lines
4.4 KiB
Smarty
$ErrorActionPreference = 'Stop'
|
|
|
|
$DataDiskLun = '${datadisk_lun}'
|
|
$DataDiskDriveLetter = '${datadisk_drive_letter}'
|
|
|
|
$TailscaleUri = 'https://pkgs.tailscale.com/stable/tailscale-setup-1.88.3-amd64.msi'
|
|
$TailscaleMsi = 'tailscale.msi'
|
|
$TailscaleInstalledExe = 'C:\Program Files\Tailscale\tailscale.exe'
|
|
$TailscaleInstallLog = 'tailscale-install.log'
|
|
# FIXME(jona): Tailscale auth-key should not be stored in plain text!
|
|
$TailscaleAuthKey = '${tailscale_authkey}'
|
|
|
|
$AmdDriverUri = 'https://download.microsoft.com/download/44ee0d6c-74dd-4214-b6d5-24fbf2eac33b/whql-amd-software-cloud-edition-25.1.1-win10-win11-azure-ngads-v620.exe'
|
|
$AmdDriverExe = 'amd-gpu-driver.exe'
|
|
$AmdDriverInstallLog = "$PWD\amd-gpu-driver-install.log"
|
|
|
|
$SunshineInstallerUri = 'https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-installer.exe'
|
|
$SunshineInstallerExe = 'sunshine-installer.exe'
|
|
|
|
$SteamInstallerUri = 'https://cdn.fastly.steamstatic.com/client/installer/SteamSetup.exe'
|
|
$SteamInstallerExe = 'steam-installer.exe'
|
|
|
|
Write-Host "Setting up data disk"
|
|
|
|
$DataDisk = Get-Disk | Where-Object { $_.Location -Like "*LUN $DataDiskLun*" }
|
|
if ($DataDisk.PartitionStyle -eq 'raw') {
|
|
Initialize-Disk -UniqueId $DataDisk.UniqueId -PartitionStyle GPT
|
|
New-Partition -DiskId $DataDisk.UniqueId -UseMaximumSize -DriveLetter $DataDiskDriveLetter
|
|
Format-Volume -DriveLetter $DataDiskDriveLetter -FileSystem NTFS -NewFileSystemLabel DataDisk -Confirm:$False
|
|
} else {
|
|
$Partition = Get-Partition -DiskNumber $DataDisk.DiskNumber | Where-Object { $_.Type -eq "Basic" }
|
|
Set-Partition -InputObject $Partition -NewDriveLetter $DataDiskDriveLetter
|
|
}
|
|
|
|
Write-Host "Done setting up data disk"
|
|
|
|
Write-Host "Provisioning software"
|
|
|
|
##
|
|
# Tailscale
|
|
Write-Host 'Setting up tailscale'
|
|
|
|
Write-Host "Downloading Tailscale MSI from $TailscaleUri to $TailscaleMsi"
|
|
Invoke-WebRequest -UseBasicParsing -Uri $TailscaleUri -OutFile $TailscaleMsi
|
|
|
|
Write-Host "Installing Tailscale from MSI to $TailscaleInstalledExe, see log at $TailscaleInstallLog"
|
|
Start-Process msiexec.exe -ArgumentList '/i', $TailscaleMsi, '/qn', '/l*v', $TailscaleInstallLog -Wait -NoNewWindow -PassThru
|
|
|
|
Write-Host 'Joining host to tailscale network'
|
|
Start-Process $TailscaleInstalledExe -ArgumentList 'up', '--authkey', $TailscaleAuthKey, '--accept-dns=false', '--accept-routes', '--unattended' -NoNewWindow -PassThru -Wait
|
|
|
|
# FIXME(jona): Tailscale auth key should not be stored in registry in plain text
|
|
Write-Host 'Creating login script to authenticate to tailscale'
|
|
$TailscaleLoginCmd = ('"{0}" login --auth-key "{1}"' -f $TailscaleInstalledExe, $TailscaleAuthKey)
|
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" `
|
|
-Name "TailscaleLogin" `
|
|
-Value "cmd /c $TailscaleLoginCmd" `
|
|
-PropertyType String -Force
|
|
|
|
Write-Host 'Done setting up tailscale'
|
|
|
|
##
|
|
# AMD GPU driver
|
|
Write-Host 'Installing AMD GPU driver'
|
|
|
|
Write-Host "Downloading AMD GPU driver installer from $AndDriverUri to $AmdDriverExe"
|
|
Invoke-WebRequest -UseBasicParsing -Uri $AmdDriverUri -OutFile $AmdDriverExe
|
|
|
|
Write-Host "Installing AMD GPU driver from, see log at $AmdDriverInstallLog"
|
|
Start-Process $AmdDriverExe -ArgumentList '-install', '-log', $AmdDriverInstallLog -Wait -NoNewWindow -PassThru
|
|
|
|
Write-Host 'Done installing AMD GPU driver'
|
|
|
|
##
|
|
# Sunshine
|
|
Write-Host "Installing Sunshine"
|
|
Write-Host "Downloading sunshine installer from $SunshineInstallerUri to $SunshineInstallerExe"
|
|
Invoke-WebRequest -UseBasicParsing -Uri $SunshineInstallerUri -OutFile $SunshineInstallerExe
|
|
|
|
Write-Host "Installing Sunshine from $SunshineInstallerExe"
|
|
Start-Process $SunshineInstallerExe -ArgumentList '/S' -Wait -NoNewWindow -PassThru
|
|
|
|
Write-Host 'Done installing Sunshine, configure at https://localhost:47990/'
|
|
|
|
##
|
|
# Steam
|
|
Write-Host "Installing Steam"
|
|
|
|
if(Test-Path "$($DataDiskDriveLetter):\Steam\Steam.exe") {
|
|
Write-Host "Steam is already installed, skipping"
|
|
} else {
|
|
Write-Host "Downloading Steam installer from $SteamInstallerUri to $SteamInstallerExe"
|
|
Invoke-WebRequest -UseBasicParsing -Uri $SteamInstallerUri -OutFile $SteamInstallerExe
|
|
|
|
Write-Host "Installing Steam from $SteamInstallerExe"
|
|
New-Item -Path "$($DataDiskDriveLetter):\" -Name 'Steam' -ItemType Directory
|
|
Start-Process $SteamInstallerExe -ArgumentList '/S', "/D=$($DataDiskDriveLetter):\Steam" -Wait -NoNewWindow -PassThru
|
|
}
|
|
|
|
Write-Host 'Done installing Steam'
|
|
|
|
Write-Host 'Done provisioning software' |