blob: d1c8acdd821448a7151f6049f930bdc22891c915 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
<#
.SYNOPSIS
Setup VRChat Devbox on Shadow PC
.DESCRIPTION
This script installs necessary software for VRChat development on a Shadow cloud-based PC.
.NOTES
Shadow: https://shadow.tech/
VRChat: https://vrchat.com/
#>
# Are we in an elevated session?
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "You do not have Administrator rights to run this script! Please re-run this script as an Administrator!"
Break
}
# is chocolatey installed?
if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
}
# pass -y to all choco installs
choco feature enable -n allowGlobalConfirmation
# disable checksum checks
choco feature disable -n checksumFiles
# Download and install Winget v1.6.3482 as Shadow's default Winget version is broken
$targetWingetVersion = "v1.6.3482"
$currentWingetVersion = (winget --version 2>$null)
if ($currentWingetVersion -ne $targetWingetVersion) {
Write-Host "Current Winget version ($currentWingetVersion) differs from target ($targetWingetVersion). Downgrading..."
Invoke-WebRequest -Uri "https://github.com/microsoft/winget-cli/releases/download/v1.6.3482/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -OutFile "C:\Users\Shadow\Downloads\Winget_Old.msixbundle"
# Install the downloaded Winget package
Add-AppxPackage -Path "C:\Users\Shadow\Downloads\Winget_Old.msixbundle"
# Clean up downloaded Winget package
Remove-Item -Path "C:\Users\Shadow\Downloads\Winget_Old.msixbundle" -Force
} else {
Write-Host "Winget is already at the target version ($targetWingetVersion). Skipping downgrade."
}
# Reset Winget source and remove msstore (has certificate issues on Shadow)
winget source reset --force
winget source remove msstore
# mass-install required software that doesn't need special setup
winget install Unity.Unity.2022 -v "2022.3.22f1" # current LTS version vrchat uses
winget install Unity.UnityHub # needed because life is pain
winget install anatawa12.ALCOM # better vrchat creator companion
winget install Git.Git # version control
winget install tailscale.tailscale # private network connectivity
winget install motrix.Motrix # download manager
winget install 7zip.7zip # archive manager
winget install microsoft.VisualStudioCode # code editor
winget install JanDeDobbeleer.OhMyPosh # fancy terminal prompt
choco install googlechrome # browser
# Remove all stuff from desktop (both user and public desktop)
Remove-Item -Path "C:\Users\Shadow\Desktop\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Users\Public\Desktop\*" -Recurse -Force -ErrorAction SilentlyContinue
# Reload environment variables to ensure newly installed software is recognized
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
# set up oh my posh
oh-my-posh font install Meslo
# set powershell prompt to oh my posh
$profilePath = "$HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
if (-not (Test-Path -Path $profilePath)) {
New-Item -ItemType File -Path $profilePath -Force
}
$ohMyPoshInit = 'oh-my-posh init pwsh | Invoke-Expression'
if (-not (Get-Content $profilePath | Select-String -Pattern 'oh-my-posh')) {
Add-Content -Path $profilePath -Value $ohMyPoshInit
}
# update windows terminal font
$wtSettingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
if (Test-Path $wtSettingsPath) {
$wtSettings = Get-Content $wtSettingsPath | ConvertFrom-Json
foreach ($profile in $wtSettings.profiles.list) {
$profile.fontFace = "MesloLGS NF"
}
$wtSettings | ConvertTo-Json -Depth 32 | Set-Content $wtSettingsPath
}
# Set desktop wallpaper to vrchat
$wallpaperUrl = "https://forgejo.sovereign.zue.dev/zuedev/monorepo/raw/branch/main/unsorted/Shadow%20VRChat%20Devbox/wallpaper.png"
$wallpaperPath = "C:\Users\Shadow\Pictures\vrchat_wallpaper.png"
Invoke-WebRequest -Uri $wallpaperUrl -OutFile $wallpaperPath
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Wallpaper {
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
}
"@
[Wallpaper]::SystemParametersInfo(20, 0, $wallpaperPath, 3)
# Set Unity Hub to use installed Unity version
$unityHubConfigPath = "C:\Users\Shadow\AppData\Roaming\UnityHub\preferences.json"
if (Test-Path $unityHubConfigPath) {
$config = Get-Content $unityHubConfigPath | ConvertFrom-Json
$config.defaultUnityVersion = "2022.3.22f1"
$config | ConvertTo-Json | Set-Content $unityHubConfigPath
}
# Set Git global configuration
git config --global user.name "zuedev"
git config --global user.email "zuedev@gmail.com"
# show file extensions in explorer
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value 0
# show hidden files in explorer
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Value 1
# reload explorer to apply changes
Stop-Process -Name explorer -Force
# Final message
Write-Host "VRChat Devbox setup complete."
|