mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-14 17:00:39 +00:00
15f584ecc6
* Check if administrator rights are required * Add INSTALL INSTRUCTIONS text file to root install folder in case the installer fails * Add failsafes to uninstaller file deletion: check if name is a folder, and check for illegal chars * Fixed parentheses breaking the installer by instead making exclamation marks do the breaking. Thanks Windows!
79 lines
2.6 KiB
Batchfile
79 lines
2.6 KiB
Batchfile
set "SCRIPTDIR=%~dp0"
|
|
set "SCRIPTDIR=%SCRIPTDIR:~0,-1%"
|
|
|
|
IF [%SRB2VERSIONNAME%] == [] set /p SRB2VERSIONNAME=<"%SCRIPTDIR%\VersionFileName.txt"
|
|
|
|
:: Find 7z
|
|
|
|
set SVZIP=
|
|
|
|
if [%1] == [] (
|
|
echo.
|
|
) else (
|
|
echo.%~1 | findstr /C:"7z" 1>nul
|
|
if errorlevel 1 (
|
|
echo.
|
|
) else (
|
|
if exist "%~1" set "SVZIP=%~1"
|
|
)
|
|
)
|
|
|
|
if ["%SVZIP%"] == [""] (
|
|
if exist "%ProgramFiles(x86)%\7-Zip\7z.exe" set "SVZIP=%ProgramFiles(x86)%\7-Zip\7z.exe"
|
|
if exist "%ProgramFiles%\7-Zip\7z.exe" set "SVZIP=%ProgramFiles%\7-Zip\7z.exe"
|
|
if exist "%ProgramW6432%\7-Zip\7z.exe" set "SVZIP=%ProgramW6432%\7-Zip\7z.exe"
|
|
)
|
|
|
|
:: Operate on install archives
|
|
|
|
type NUL > "%SCRIPTDIR%\staging\new-install\staging.txt"
|
|
|
|
if exist "%SCRIPTDIR%\Installer.7z" (
|
|
if ["%SVZIP%"] == [""] (
|
|
echo.
|
|
) else (
|
|
cd "%SCRIPTDIR%\staging"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\staging\new-install"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
|
|
cd "%SCRIPTDIR%"
|
|
)
|
|
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2.sfx" + "%SCRIPTDIR%\sfx\config-installer.txt" + "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-Installer.exe"
|
|
)
|
|
|
|
if exist "%SCRIPTDIR%\Patch.7z" (
|
|
if ["%SVZIP%"] == [""] (
|
|
echo.
|
|
) else (
|
|
cd "%SCRIPTDIR%\staging"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\staging\new-install\"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
|
|
cd "%SCRIPTDIR%"
|
|
)
|
|
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2.sfx" + "%SCRIPTDIR%\sfx\config-patch.txt" + "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-Patch.exe"
|
|
)
|
|
|
|
if exist "%SCRIPTDIR%\Installer_x64.7z" (
|
|
if ["%SVZIP%"] == [""] (
|
|
echo.
|
|
) else (
|
|
cd "%SCRIPTDIR%\staging"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\staging\new-install\"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
|
|
cd "%SCRIPTDIR%"
|
|
)
|
|
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2_x64.sfx" + "%SCRIPTDIR%\sfx\config-installer.txt" + "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-x64-Installer.exe"
|
|
)
|
|
|
|
if exist "%SCRIPTDIR%\Patch_x64.7z" (
|
|
if ["%SVZIP%"] == [""] (
|
|
echo.
|
|
) else (
|
|
cd "%SCRIPTDIR%\staging"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\staging\new-install\"
|
|
"%SVZIP%" a "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
|
|
cd "%SCRIPTDIR%"
|
|
)
|
|
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2_x64.sfx" + "%SCRIPTDIR%\sfx\config-patch.txt" + "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-x64-Patch.exe"
|
|
)
|
|
|
|
del /f /q "%SCRIPTDIR%\staging\new-install\staging.txt"
|