Skip to content

Commit

Permalink
Added script for one click start (arriven#130)
Browse files Browse the repository at this point in the history
* Added script for one click start

* Moved script
  • Loading branch information
Devaniti authored Mar 5, 2022
1 parent 2fb08e3 commit b46856c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions scripts/StartDB1000N.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
echo $SaveFolder = $args[0] > %temp%\GetDB1000N.ps1
echo if ($args.count -lt 1) >> %temp%\GetDB1000N.ps1
echo { >> %temp%\GetDB1000N.ps1
echo Write-Host "Missing save folder parameter" >> %temp%\GetDB1000N.ps1
echo } >> %temp%\GetDB1000N.ps1
echo New-Item -ItemType Directory -Force -Path $SaveFolder >> %temp%\GetDB1000N.ps1
echo $JSONURL = "https://api.github.com/repos/Arriven/db1000n/releases/latest" >> %temp%\GetDB1000N.ps1
echo $JSON = Invoke-WebRequest -Uri $JSONURL >> %temp%\GetDB1000N.ps1
echo $ParsedJSON = ConvertFrom-Json -InputObject $JSON >> %temp%\GetDB1000N.ps1
echo $Assets = Select-Object -InputObject $ParsedJSON -ExpandProperty assets >> %temp%\GetDB1000N.ps1
echo Foreach ($Asset IN $Assets) >> %temp%\GetDB1000N.ps1
echo { >> %temp%\GetDB1000N.ps1
echo if ($Asset.name -match 'db1000n-.*-windows-amd64.zip') >> %temp%\GetDB1000N.ps1
echo { >> %temp%\GetDB1000N.ps1
echo $DownloadURL = $Asset.browser_download_url >> %temp%\GetDB1000N.ps1
echo $ZIPPath = Join-Path -Path $SaveFolder -ChildPath "db1000n.zip" >> %temp%\GetDB1000N.ps1
echo Invoke-WebRequest -Uri $DownloadURL -OutFile $ZIPPath >> %temp%\GetDB1000N.ps1
echo Expand-Archive -Path $ZIPPath -DestinationPath $SaveFolder -Force >> %temp%\GetDB1000N.ps1
echo Remove-Item -Path $ZIPPath >> %temp%\GetDB1000N.ps1
echo Write-Host "Sucessfully downloaded DB1000N $($Asset.name)" >> %temp%\GetDB1000N.ps1
echo exit 0 >> %temp%\GetDB1000N.ps1
echo } >> %temp%\GetDB1000N.ps1
echo } >> %temp%\GetDB1000N.ps1
echo Write-Host "Something went wrong, couldn't download DB1000N" >> %temp%\GetDB1000N.ps1
echo exit 1 >> %temp%\GetDB1000N.ps1

powershell -ExecutionPolicy Bypass -File %temp%\GetDB1000N.ps1 %temp%
%temp%/db1000n.exe

0 comments on commit b46856c

Please sign in to comment.