|
### Version Setting ### |
|
$AmongUsCaptureVersion = '2.8.8' |
|
$GalactusVersion = '2.4.1' |
|
$AutomuteusVersion = '6.9.2' |
|
|
|
# SET YOUR DISCORD BOT TOKEN |
|
$DiscordBotToken = '' |
|
|
|
# Set here if you want to |
|
$GalactusHost = 'http://localhost' |
|
$GalactusExternalPort = '80' |
|
|
|
# DownloadFile downloads the resource on $targetURL into $outFilePath |
|
function DownloadFile($targetURL, $outFilePath) { |
|
$uri = New-Object System.Uri($targetURL) |
|
Invoke-WebRequest -Uri $uri -OutFile $outFilePath -UseBasicParsing |
|
if (!$?) { |
|
return 'failed Invoke-WebRequest: ' + $targetURL + ', ' + $outFilePath |
|
} |
|
return '' |
|
} |
|
|
|
# DownloadAndUnzipFile download the resource on $targetURL into $outFilePath & unzip the file |
|
function DownloadAndUnzipFile($targetURL, $outFilePath) { |
|
# download file |
|
$outFilePathZip = $outFilePath + ".zip" |
|
$errMes = DownloadFile $targetURL $outFilePathZip |
|
if (![string]::IsNullOrEmpty($errMes)) { |
|
return 'failed DownloadFile: ' + $errMes |
|
} |
|
Expand-Archive -Path $outFilePathZip -DestinationPath '.' |
|
if (!$?) { |
|
Remove-Item $outFilePathZip |
|
return 'failed Expand-Archive: ' + $errMes |
|
} |
|
Remove-Item $outFilePathZip |
|
return '' |
|
} |
|
|
|
# install docker |
|
function InstallDocker() { |
|
# check whether docker exists or not |
|
$dockerInstalledPath = 'C:\Program Files\Docker\Docker\Docker Desktop.exe' |
|
$res = Test-Path $dockerInstalledPath |
|
if ($res) { |
|
Get-Command docker -ea SilentlyContinue | Out-Null |
|
if ($? -ne $true) { |
|
Start-Process -FilePath $dockerInstalledPath |
|
} |
|
return 'Successfully installed Docker!' |
|
} |
|
$dockerOutFilePath = 'DockerInstaller.exe' |
|
$res = Test-Path $dockerOutFilePath |
|
if (!$res) { |
|
$dockerTargetURL = 'https://desktop.docker.com/win/stable/Docker Desktop Installer.exe' |
|
$errMes = DownloadFile $dockerTargetURL $dockerOutFilePath |
|
if (![string]::IsNullOrEmpty($errMes)) { |
|
return 'failed to download file for Docker: ' + $errMes |
|
} |
|
} |
|
# run Docker |
|
.\DockerInstaller.exe |
|
if (!$?) { |
|
return 'failed to install Docker' |
|
} |
|
Remove-Item .\DockerInstaller.exe |
|
return '' |
|
} |
|
|
|
# install AmongUsCapture |
|
function InstallAmongUsCapture() { |
|
$captureOutFilePath = $AmongUsCaptureVersion |
|
$captureTargetURL = 'https://github.com/denverquane/amonguscapture/releases/download/' + $AmongUsCaptureVersion + '/AmongUsCapture.zip' |
|
|
|
# check whether amonguscapture exists or not |
|
$res = Test-Path "AmongUsCapture.exe" |
|
if ($res) { |
|
return 'Successfully installed AmongUsCapture!' |
|
} |
|
|
|
$errMes = DownloadAndUnzipFile $captureTargetURL $captureOutFilePath |
|
if (![string]::IsNullOrEmpty($errMes)) { |
|
return 'failed to download file for AmongUsCapture: ' + $errMes |
|
} |
|
|
|
# check whether amonguscapture exists or not |
|
$res = Test-Path "AmongUsCapture.exe" |
|
if ($res) { |
|
return 'Successfully installed AmongUsCapture!' |
|
} |
|
} |
|
|
|
# install galactus |
|
function InstallGalactUs() { |
|
$galactusTargetURL = 'https://github.com/automuteus/galactus/archive/' + $GalactusVersion + '.zip' |
|
$galactusOutFilePath = 'galactus' |
|
|
|
# check whether galactus exists or not |
|
$res = Test-Path ($galactusOutFilePath + "-" + $GalactusVersion) |
|
if ($res) { |
|
return 'Successfully installed Galactus!' |
|
} |
|
|
|
$errMes = DownloadAndUnzipFile $galactusTargetURL $galactusOutFilePath |
|
if (![string]::IsNullOrEmpty($errMes)) { |
|
return 'failed to download file for galactus: ' + $errMes |
|
} |
|
|
|
# check whether galactus exists or not |
|
$res = Test-Path ($galactusOutFilePath + "-" + $GalactusVersion) |
|
if ($res) { |
|
return 'Successfully installed Galactus!' |
|
} |
|
} |
|
|
|
# install automuteus |
|
function InstallAutomuteus() { |
|
$automuteusTargetURL = 'https://github.com/denverquane/automuteus/archive/' + $AutomuteusVersion + '.zip' |
|
$automuteusOutFilePath = 'automuteus' |
|
|
|
# check whether automuteus exists or not |
|
$res = Test-Path ($automuteusOutFilePath + "-" + ${AutomuteusVersion}) |
|
if ($res) { |
|
return 'Successfully installed automuteus!' |
|
} |
|
|
|
$errMes = DownloadAndUnzipFile $automuteusTargetURL $automuteusOutFilePath |
|
if (![string]::IsNullOrEmpty($errMes)) { |
|
return 'failed to download file for automuteus: ' + $errMes |
|
} |
|
|
|
# check whether amongmuteus exists or not |
|
$res = Test-Path ($automuteusOutFilePath + "-" + ${AutomuteusVersion}) |
|
if ($res) { |
|
return 'Successfully installed automuteus!' |
|
} |
|
} |
|
|
|
|
|
# helper for adding params |
|
function addEnvParam($targetFilePath, $regexp, $param) { |
|
((Get-Content -path $targetFilePath -Raw) -replace $regexp,($regexp + $param)) | Set-Content -Path $targetFilePath |
|
} |
|
|
|
|
|
# init automuteus |
|
function InitAutomuteus() { |
|
$basePath = "automuteus-" + $AutomuteusVersion |
|
$envFilePath = $basePath + "/.env" |
|
Copy-Item ($basePath + "/sample.env") $envFilePath |
|
addEnvParam $envFilePath "AUTOMUTEUS_TAG=" $AutomuteusVersion |
|
addEnvParam $envFilePath "GALACTUS_TAG=" $GalactusVersion |
|
addEnvParam $envFilePath "DISCORD_BOT_TOKEN=" $DiscordBotToken |
|
addEnvParam $envFilePath "GALACTUS_HOST=" $GalactusHost |
|
addEnvParam $envFilePath "GALACTUS_EXTERNAL_PORT=" $GalactusExternalPort |
|
} |
|
|
|
|
|
InstallDocker |
|
InstallDockerCompose |
|
InstallAmongUsCapture |
|
InstallGalactus |
|
InstallAutomuteus |
|
InitAutomuteus |