forked from Lan2Play/PugSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-windows.ps1
64 lines (51 loc) · 2.83 KB
/
install-windows.ps1
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
$TARGET_DIR = "cs2\game\csgo"
$GAMEINFO_FILE = "$TARGET_DIR\gameinfo.gi"
Write-Output "Install SteamCMD"
winget install --id Valve.SteamCMD --exact --accept-source-agreements --disable-interactivity --accept-source-agreements --force
Write-Output "Create csgo folder"
New-Item -ItemType Directory -Force -Path $TARGET_DIR
Write-Output "Install CS2"
Start-Process -NoNewWindow -FilePath "$env:LOCALAPPDATA\Microsoft\WinGet\Links\steamcmd" -ArgumentList "+force_install_dir $PSScriptRoot\cs2\ +login Anonymous +app_update 730"
# Start-Process -NoNewWindow -FilePath "$env:LOCALAPPDATA\Microsoft\WinGet\Links\steamcmd" -ArgumentList "+force_install_dir $PSScriptRoot\cs2\ +login Anonymous +app_update 730 validate +exit"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Installed CS2"
Write-Output "Load MetaModVersion"
$latestMM = Invoke-RestMethod "https://mms.alliedmods.net/mmsdrop/2.0/mmsource-latest-windows"
Write-Output "Download MetaMod Version $latestMM"
Invoke-WebRequest "https://mms.alliedmods.net/mmsdrop/2.0/$latestMM" -OutFile "$TARGET_DIR\latestMM.zip"
Write-Output "Extract MetaMod Version $latestMM"
Expand-Archive "$TARGET_DIR\latestMM.zip" -DestinationPath $TARGET_DIR -Force
Write-Output "Fix GameInfo"
if (Test-Path $GAMEINFO_FILE) {
$NEW_ENTRY = " Game csgo/addons/metamod"
$SEL = Select-String -Path $GAMEINFO_FILE -Pattern $NEW_ENTRY
if ($SEL -ne $null) {
Write-Output "The entry '$NEW_ENTRY' already exists in $GAMEINFO_FILE. No changes were made."
}
else {
(Get-Content $GAMEINFO_FILE) |
Foreach-Object {
$_ # send the current line to output
if ($_ -match "Game_LowViolence") {
#Add Lines after the selected pattern
$NEW_ENTRY
}
} | Set-Content $GAMEINFO_FILE
Write-Output "The file $GAMEINFO_FILE has been modified successfully. '$NEW_ENTRY' has been added."
}
}
Write-Output "Install CounterStrikeSharp"
# TODO Install CSS
# wget -q -O $(currentDir)/counterstrikesharp.zip $(shell curl -s -L -H "Accept: application/vnd.github+json" https://api.github.com/repos/roflmuffin/CounterStrikeSharp/releases/tags/$(shell dotnet list PugSharp/PugSharp.csproj package --format json | jq -r '.projects[].frameworks[].topLevelPackages[] | select(.id == "CounterStrikeSharp.API") | .resolvedVersion' | sed 's|1.0.|v|g') | jq -r '.assets[] | select(.browser_download_url | test("with-runtime")) | .browser_download_url')
Write-Output "Successfully prepared CS. To start: .\cs2\game\bin\win64\cs2.exe -dedicated +map de_dust2"