Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- rem requires 7-Zip, UnxUtils (wget, md5sum, ln)
- rem UnxUtils must be in the PATH environment variable
- set "base=%~dp0"
- set "sevenzipdir=%ProgramFiles%\7-Zip"
- set "installdir=%base%Quake II .NET"
- set "demofile=%base%q2-314-demo-x86.exe"
- set "pakfile=%base%pak0.pak"
- set "msifile=%base%Quake II .NET.msi"
- if exist "%sevenzipdir%" (
- rem add 7-Zip to PATH
- set "path=%path%;%sevenzipdir%"
- ) else (
- echo.Error: 7-Zip not installed.
- goto end
- )
- if not exist "%installdir%" (
- mkdir "%installdir%"
- :extractmsi
- if exist "%msifile%" (
- rem extract the files from the msi
- msiexec /a "%msifile%" /qb TARGETDIR="%installdir%"
- ) else (
- rem try to download the necessary file
- rem note: wget command is not standard on windows
- wget "http://www.vertigoprojects.com/Quake2NETDownloads/Quake II .NET.msi"
- if not exist "%msifile%.md5" (
- echo.0be4d6c7f6a20436f59699ce707438f7 *Quake II .NET.msi>"%msifile%.md5"
- )
- rem try to verify the msi
- rem note: md5sum command is not standard on windows
- md5sum -c "%msifile%.md5"
- if "%errorlevel%"=="0" (
- goto extractmsi
- ) else (
- echo.Error: Failed to download Quake II .NET.msi
- if exist "%msifile%" (
- del /f /q "%msifile%"
- )
- goto end
- )
- )
- :extractpak
- if exist "%demofile%" (
- rem extract the pak file from the demo exe
- rem note: needs 7-Zip installed to do this
- 7z e -o"%base%" "%demofile%" "Install\Data\baseq2\pak0.pak"
- ) else (
- rem try to download the necessary file
- rem note: this may take a very long time depending on server load
- wget "ftp://ftp.idsoftware.com/idstuff/quake2/q2-314-demo-x86.exe"
- if not exist "%demofile%.md5" (
- echo.4d1cd4618e80a38db59304132ea0856c q2-314-demo-x86.exe>"%demofile%.md5"
- )
- rem try to verify demo exe
- md5sum -c "%demofile%.md5"
- if "%errorlevel%"=="0" (
- goto extractpak
- ) else (
- echo.Error: Failed to download q2-314-demo-x86.exe
- if exist "%demofile%" (
- del /f /q "%demofile%"
- )
- goto end
- )
- )
- if exist "%pakfile%" (
- rem link the pak file in the necessary directories
- rem note: ln command is not standard on windows
- if exist "%installdir%\managed\baseq2" (
- ln "%pakfile%" "%installdir%\managed\baseq2\pak0.pak"
- )
- if exist "%installdir%\native\baseq2" (
- ln "%pakfile%" "%installdir%\native\baseq2\pak0.pak"
- )
- )
- )
- echo.Done.
- :end
- pause
- @exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement