mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Add new Windows installer scripts
This commit is contained in:
parent
b1c41a193b
commit
d4718fa6d1
11 changed files with 656 additions and 0 deletions
9
windows-installer/.gitignore
vendored
Normal file
9
windows-installer/.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
*
|
||||||
|
*.*
|
||||||
|
!new-install
|
||||||
|
!sfx
|
||||||
|
!! MAKE SURE FILES ARE IN new-install ARCHIVE FOLDER !.txt
|
||||||
|
!BuildInstaller.bat
|
||||||
|
!README.txt
|
||||||
|
!VersionFileName.txt
|
||||||
|
!.gitignore
|
63
windows-installer/BuildInstaller.bat
Normal file
63
windows-installer/BuildInstaller.bat
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
if exist "%SCRIPTDIR%\Installer.7z" (
|
||||||
|
if ["%SVZIP%"] == [""] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
"%SVZIP%" a "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\new-install"
|
||||||
|
)
|
||||||
|
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 (
|
||||||
|
"%SVZIP%" a "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\new-install\"
|
||||||
|
)
|
||||||
|
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 (
|
||||||
|
"%SVZIP%" a "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\new-install\"
|
||||||
|
)
|
||||||
|
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 (
|
||||||
|
"%SVZIP%" a "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\new-install\"
|
||||||
|
)
|
||||||
|
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2_x64.sfx" + "%SCRIPTDIR%\sfx\config-patch.txt" + "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-x64-Patch.exe"
|
||||||
|
)
|
48
windows-installer/README.txt
Normal file
48
windows-installer/README.txt
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
Windows Install Builder
|
||||||
|
for SRB2
|
||||||
|
|
||||||
|
This installer is much like the 7-Zip self-extracting archive, except
|
||||||
|
this allows for scripting the post-install step.
|
||||||
|
|
||||||
|
This also allows for some light customization, including dialog messages
|
||||||
|
and program shortcuts.
|
||||||
|
|
||||||
|
The included install scripts manage the game data location depending on the
|
||||||
|
install location -- if installed in Program Files or AppData\Local, the
|
||||||
|
game data location is set to %UserProfile%\SRB2.
|
||||||
|
|
||||||
|
Program shortcuts are also added, as well as an uninstaller that
|
||||||
|
will remove the icons and also selectively uninstall the core game files.
|
||||||
|
The uninstaller gives you the option to preserve your game data and mods.
|
||||||
|
|
||||||
|
How to Use
|
||||||
|
----------
|
||||||
|
|
||||||
|
1. Zip up the install contents in 7z format.
|
||||||
|
* ALL FILES MUST BE IN THE `new-install/` ARCHIVE SUBFOLDER, OR THE
|
||||||
|
POST-INSTALL SCRIPT WILL NOT WORK!
|
||||||
|
* Make sure you are using the LZMA2 algorithm, which is 7-Zip's default.
|
||||||
|
|
||||||
|
2. Copy the 7z archive to this folder using the following names:
|
||||||
|
* Installer.7z - 32-bit full installer
|
||||||
|
* Patch.7z - 32-bit patch
|
||||||
|
* Installer_x64.7z - 64-bit full installer
|
||||||
|
* Patch_x64.7z - 64-bit full installer
|
||||||
|
|
||||||
|
3. Set the text in VersionFilename.txt to the version identifier for the
|
||||||
|
installer's filename.
|
||||||
|
* e.g., v2121 for v2.1.21, from "SRB2-v2121-Installer.exe"
|
||||||
|
* Also look through sfx/config-installer.txt and sfx/config-patch.txt
|
||||||
|
and update the version strings. Templating is TODO.
|
||||||
|
|
||||||
|
4. Run BuildInstaller.bat [7z.exe install path]
|
||||||
|
* First argument is the path to 7z.exe. If this is not specified, the
|
||||||
|
script will try to look for it in C:\Program Files [(x86)]
|
||||||
|
* This script will automatically add the install scripts to each
|
||||||
|
installer.
|
||||||
|
|
||||||
|
Credit
|
||||||
|
------
|
||||||
|
|
||||||
|
OlegScherbakov/7zSFX
|
||||||
|
https://github.com/OlegScherbakov/7zSFX
|
1
windows-installer/VersionFileName.txt
Normal file
1
windows-installer/VersionFileName.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
v2121
|
236
windows-installer/new-install/staging.bat
Normal file
236
windows-installer/new-install/staging.bat
Normal file
|
@ -0,0 +1,236 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
cls
|
||||||
|
|
||||||
|
:: SRB2 Install Staging
|
||||||
|
::
|
||||||
|
:: This accomplishes the following tasks:
|
||||||
|
::
|
||||||
|
:: 1. Creates a user profile folder if SRB2 is installed in AppData or Program Files, and config.cfg is not already in the install folder
|
||||||
|
::
|
||||||
|
:: 2. Moves old installation files into old-install
|
||||||
|
::
|
||||||
|
:: 3. Moves new installaton files into install folder
|
||||||
|
::
|
||||||
|
|
||||||
|
:: For 2.1.21, we are changing the DLL structure
|
||||||
|
:: So move everything that's EXE or DLL
|
||||||
|
|
||||||
|
set MoveOldExesDlls=1
|
||||||
|
|
||||||
|
:: Get Parent folder (the SRB2 install folder)
|
||||||
|
::
|
||||||
|
:: https://wiert.me/2011/08/30/batch-file-to-get-parent-directory-not-the-directory-of-the-batch-file-but-the-parent-of-that-directory/
|
||||||
|
|
||||||
|
set "STAGINGDIR=%~dp0"
|
||||||
|
:: strip trailing backslash
|
||||||
|
set "STAGINGDIR=%STAGINGDIR:~0,-1%"
|
||||||
|
:: ~dp only works for batch file parameters and loop indexes
|
||||||
|
for %%d in ("%STAGINGDIR%") do set INSTALLDIR=%%~dpd
|
||||||
|
set "INSTALLDIR=%INSTALLDIR:~0,-1%"
|
||||||
|
|
||||||
|
:: Check if we need to create %userprofile%\SRB2
|
||||||
|
|
||||||
|
set "USERDIR=%INSTALLDIR%"
|
||||||
|
|
||||||
|
:: Is config.cfg in our install dir?
|
||||||
|
if exist "%INSTALLDIR%\config.cfg" goto MoveOldInstall
|
||||||
|
|
||||||
|
:: Are we in AppData?
|
||||||
|
echo.%STAGINGDIR% | findstr /C:"%LocalAppData%" 1>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
goto SetUserDir
|
||||||
|
)
|
||||||
|
|
||||||
|
: Are we in Program Files?
|
||||||
|
echo.%STAGINGDIR% | findstr /C:"%ProgramFiles%" 1>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
goto SetUserDir
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Are we in Program Files (x86)?
|
||||||
|
echo.%STAGINGDIR% | findstr /C:"%ProgramFiles(X86)%" 1>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
goto SetUserDir
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Are we 32-bit and actually in Program Files?
|
||||||
|
echo.%STAGINGDIR% | findstr /C:"%ProgramW6432%" 1>nul
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
goto SetUserDir
|
||||||
|
)
|
||||||
|
|
||||||
|
goto MoveOldInstall
|
||||||
|
|
||||||
|
: SetUserDir
|
||||||
|
|
||||||
|
:: If the user folder already exists, there's nothing to do
|
||||||
|
set "USERDIR=%UserProfile%\SRB2"
|
||||||
|
|
||||||
|
:: set USERDIREXISTS=
|
||||||
|
:: if exist "%USERDIR%\*" (
|
||||||
|
:: set USERDIREXISTS=1
|
||||||
|
:: )
|
||||||
|
|
||||||
|
:: Make the folder!
|
||||||
|
mkdir "%USERDIR%"
|
||||||
|
|
||||||
|
:: Now copy READMEs
|
||||||
|
:: echo f answers xcopy's prompt as to whether the destination is a file or a folder
|
||||||
|
echo f | xcopy /y "%STAGINGDIR%\README.txt" "%USERDIR%\README.txt"
|
||||||
|
echo f | xcopy /y "%STAGINGDIR%\LICENSE.txt" "%USERDIR%\LICENSE.txt"
|
||||||
|
echo f | xcopy /y "%STAGINGDIR%\LICENSE-3RD-PARTY.txt" "%USERDIR%\LICENSE-3RD-PARTY.txt"
|
||||||
|
echo Your game data and mods folder is: > "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo. >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo "%USERDIR%" >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo. >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo Your install folder is: >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo. >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo "%INSTALLDIR%" >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo. >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo To run SRB2, go to: >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo. >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
echo Start Menu ^> Programs ^> Sonic Robo Blast 2 >> "%USERDIR%\! Data and Mods Go Here !.txt"
|
||||||
|
|
||||||
|
:: Copy path to install folder
|
||||||
|
|
||||||
|
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
|
||||||
|
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
|
||||||
|
echo sLinkFile = "%USERDIR%\! SRB2 Install Folder !.lnk" >> %SCRIPT%
|
||||||
|
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
|
||||||
|
echo oLink.TargetPath = "%INSTALLDIR%" >> %SCRIPT%
|
||||||
|
echo oLink.WorkingDirectory = "%INSTALLDIR%" >> %SCRIPT%
|
||||||
|
echo oLink.Arguments = "" >> %SCRIPT%
|
||||||
|
echo oLink.IconLocation = "%INSTALLDIR%\srb2win.exe,0" >> %SCRIPT%
|
||||||
|
echo oLink.Save >> %SCRIPT%
|
||||||
|
cscript /nologo %SCRIPT%
|
||||||
|
del %SCRIPT%
|
||||||
|
|
||||||
|
:: Also do it the other way around
|
||||||
|
|
||||||
|
set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
|
||||||
|
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
|
||||||
|
echo sLinkFile = "%INSTALLDIR%\! SRB2 Data Folder !.lnk" >> %SCRIPT%
|
||||||
|
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
|
||||||
|
echo oLink.TargetPath = "%USERDIR%" >> %SCRIPT%
|
||||||
|
echo oLink.WorkingDirectory = "%USERDIR%" >> %SCRIPT%
|
||||||
|
echo oLink.Arguments = "" >> %SCRIPT%
|
||||||
|
echo oLink.IconLocation = "%INSTALLDIR%\srb2win.exe,0" >> %SCRIPT%
|
||||||
|
echo oLink.Save >> %SCRIPT%
|
||||||
|
cscript /nologo %SCRIPT%
|
||||||
|
del %SCRIPT%
|
||||||
|
|
||||||
|
: MoveOldInstall
|
||||||
|
|
||||||
|
if exist "%INSTALLDIR%\old-install\*" (
|
||||||
|
set "OLDINSTALLDIR=%INSTALLDIR%\old-install-%RANDOM%"
|
||||||
|
) else (
|
||||||
|
set "OLDINSTALLDIR=%INSTALLDIR%\old-install"
|
||||||
|
)
|
||||||
|
|
||||||
|
mkdir "%OLDINSTALLDIR%"
|
||||||
|
|
||||||
|
:
|
||||||
|
: Move all EXEs and DLLs
|
||||||
|
:
|
||||||
|
|
||||||
|
set OLDINSTALLCHANGED=
|
||||||
|
|
||||||
|
if ["%MoveOldExesDlls%"] == [""] goto MoveOldInstallNewFiles
|
||||||
|
|
||||||
|
: MoveOldInstallExeDll
|
||||||
|
|
||||||
|
xcopy /y /v "%INSTALLDIR%\*.exe" "%OLDINSTALLDIR%"
|
||||||
|
if errorlevel 0 del /f /q "%INSTALLDIR%\*.exe"
|
||||||
|
xcopy /y /v "%INSTALLDIR%\*.dll" "%OLDINSTALLDIR%"
|
||||||
|
if errorlevel 0 del /f /q "%INSTALLDIR%\*.dll"
|
||||||
|
|
||||||
|
for %%F in ("%OLDINSTALLDIR%\*") DO (
|
||||||
|
set OLDINSTALLCHANGED=1
|
||||||
|
goto MoveOldInstallNewFiles
|
||||||
|
)
|
||||||
|
|
||||||
|
: MoveOldInstallNewFiles
|
||||||
|
|
||||||
|
:: Save a list of standard files
|
||||||
|
:: So the uninstall script will know what to remove
|
||||||
|
:: Append to any existing file, in case we are a patch
|
||||||
|
|
||||||
|
dir /b /a-d "%STAGINGDIR%" >> "%INSTALLDIR%\uninstall-list.txt"
|
||||||
|
|
||||||
|
:: Overwrite the last known gamedata folder
|
||||||
|
|
||||||
|
echo %USERDIR% > "%INSTALLDIR%\uninstall-userdir.txt"
|
||||||
|
|
||||||
|
:: Add the install-generated to the uninstall list
|
||||||
|
|
||||||
|
echo uninstall-list.txt >> "%INSTALLDIR%\uninstall-list.txt"
|
||||||
|
echo uninstall-userdir.txt >> "%INSTALLDIR%\uninstall-list.txt"
|
||||||
|
echo ! SRB2 Data Folder !.lnk >> "%INSTALLDIR%\uninstall-list.txt"
|
||||||
|
|
||||||
|
:: Start moving files
|
||||||
|
|
||||||
|
for %%F in ("%STAGINGDIR%\*") DO (
|
||||||
|
if exist "%INSTALLDIR%\%%~nxF" (
|
||||||
|
set OLDINSTALLCHANGED=1
|
||||||
|
move "%INSTALLDIR%\%%~nxF" "%OLDINSTALLDIR%\%%~nxF"
|
||||||
|
)
|
||||||
|
if ["%%~nxF"] == ["staging.bat"] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
move "%STAGINGDIR%\%%~nxF" "%INSTALLDIR%\%%~nxF"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
: Finished
|
||||||
|
|
||||||
|
set MSGEXE=
|
||||||
|
if exist "%SystemRoot%\System32\msg.exe" (
|
||||||
|
set MSGEXE=%SystemRoot%\System32\msg.exe
|
||||||
|
) else (
|
||||||
|
if exist "%SystemRoot%\Sysnative\msg.exe" (
|
||||||
|
set MSGEXE=%SystemRoot%\Sysnative\msg.exe
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if ["%OLDINSTALLCHANGED%"] == ["1"] (
|
||||||
|
"%systemroot%\explorer.exe" /select, "%OLDINSTALLDIR%"
|
||||||
|
echo Finished! Some of your old installation files were moved to the "old-install" folder. > %TEMP%\srb2msgprompt.txt
|
||||||
|
echo. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
echo If you no longer need these files, you may delete the folder safely. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
echo. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
echo To run SRB2, go to: Start Menu ^> Programs ^> Sonic Robo Blast 2. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
%MSGEXE% "%username%" < %TEMP%\srb2msgprompt.txt
|
||||||
|
del %TEMP%\srb2msgprompt.txt
|
||||||
|
) else (
|
||||||
|
if /I ["%USERDIR%"] == ["%INSTALLDIR%"] (
|
||||||
|
"%systemroot%\explorer.exe" "%INSTALLDIR%"
|
||||||
|
echo Finished! > %TEMP%\srb2msgprompt.txt
|
||||||
|
echo. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
echo To run SRB2, go to: Start Menu ^> Programs ^> Sonic Robo Blast 2. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
%MSGEXE% "%username%" < %TEMP%\srb2msgprompt.txt
|
||||||
|
del %TEMP%\srb2msgprompt.txt
|
||||||
|
) else (
|
||||||
|
"%systemroot%\explorer.exe" "%USERDIR%"
|
||||||
|
echo Finished! You may find your game data in this folder: > %TEMP%\srb2msgprompt.txt
|
||||||
|
echo. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
echo %USERDIR% >> %TEMP%\srb2msgprompt.txt
|
||||||
|
echo. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
echo To run SRB2, go to: Start Menu ^> Programs ^> Sonic Robo Blast 2. >> %TEMP%\srb2msgprompt.txt
|
||||||
|
%MSGEXE% "%username%" < %TEMP%\srb2msgprompt.txt
|
||||||
|
del %TEMP%\srb2msgprompt.txt
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
: Attempt to remove OLDINSTALLDIR, in case it's empty
|
||||||
|
rmdir /q "%OLDINSTALLDIR%"
|
||||||
|
cd \
|
||||||
|
start "" /b "cmd" /s /c " del /f /q "%STAGINGDIR%\*"&rmdir /s /q "%STAGINGDIR%"&exit /b "
|
251
windows-installer/new-install/uninstall.bat
Normal file
251
windows-installer/new-install/uninstall.bat
Normal file
|
@ -0,0 +1,251 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
cls
|
||||||
|
|
||||||
|
set "INSTALLDIR=%~dp0"
|
||||||
|
set "INSTALLDIR=%INSTALLDIR:~0,-1%"
|
||||||
|
set /p USERDIR=<"%INSTALLDIR%\uninstall-userdir.txt"
|
||||||
|
set "USERDIR=%USERDIR:~0,-1%"
|
||||||
|
|
||||||
|
: ProceedPrompt
|
||||||
|
|
||||||
|
set PROCEED=
|
||||||
|
set /p PROCEED="Are you sure you want to uninstall SRB2? [yes/no] "
|
||||||
|
|
||||||
|
if /I ["%PROCEED:~0,1%"] == ["n"] exit
|
||||||
|
if /I ["%PROCEED%"] == ["y"] (
|
||||||
|
echo Type Yes or No
|
||||||
|
echo.
|
||||||
|
goto ProceedPrompt
|
||||||
|
) else (
|
||||||
|
if /I ["%PROCEED%"] == ["yes"] (
|
||||||
|
set PROCEED=1
|
||||||
|
) else (
|
||||||
|
echo.
|
||||||
|
goto ProceedPrompt
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Failsafe, in case we Ctrl+C and decline "Terminate batch file?"
|
||||||
|
|
||||||
|
if ["%PROCEED%"] == ["1"] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
exit
|
||||||
|
)
|
||||||
|
|
||||||
|
: DeleteAllPrompt
|
||||||
|
|
||||||
|
:: TODO: Let's DUMMY this out for now -- I'm not confident that a full-folder
|
||||||
|
:: deletion wouldn't be disastrous for edge-cases. E.g., what if we somehow got
|
||||||
|
:: Program Files as the folder to delete? Or C:\?
|
||||||
|
::
|
||||||
|
:: Let's just delete individual files, attempt to delete the folder if it is
|
||||||
|
:: empty, then leave it up to the user to clear the rest. Yes, their data
|
||||||
|
:: and mods will be left alone by the uninstaller.
|
||||||
|
::
|
||||||
|
:: mazmazz 12/2/2018
|
||||||
|
|
||||||
|
set DELETEALL=
|
||||||
|
|
||||||
|
goto DeleteFiles
|
||||||
|
|
||||||
|
echo Do you want to delete your game data and mods? In folder:
|
||||||
|
echo %USERDIR%
|
||||||
|
|
||||||
|
set /p DELETEALL="[Yes/no] "
|
||||||
|
|
||||||
|
if /I ["%DELETEALL:~0,1%"] == ["n"] (
|
||||||
|
set DELETEALL=
|
||||||
|
goto DeleteFiles
|
||||||
|
)
|
||||||
|
|
||||||
|
if /I ["%DELETEALL%"] == ["y"] (
|
||||||
|
echo Type Yes or No
|
||||||
|
goto DeleteAllPrompt
|
||||||
|
) else (
|
||||||
|
if /I ["%DELETEALL%"] == ["yes"] (
|
||||||
|
set DELETEALL=1
|
||||||
|
) else (
|
||||||
|
echo.
|
||||||
|
goto DeleteAllPrompt
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
:: TODO: Would be nice to have an additional prompt asking
|
||||||
|
:: Are you REALLY sure you want to delete your data? You cannot
|
||||||
|
:: recover it!
|
||||||
|
|
||||||
|
: DeleteAll
|
||||||
|
|
||||||
|
:: Dummy out for now
|
||||||
|
|
||||||
|
goto DeleteFiles
|
||||||
|
|
||||||
|
:: Failsafe to not delete the directory if, SOMEHOW,
|
||||||
|
:: your install dir or user dir is C:\
|
||||||
|
set SAMEFAILSAFE=
|
||||||
|
|
||||||
|
:: Don't delete the install folder until the very last step of the script!
|
||||||
|
if ["%DELETEALL%"] == ["1"] (
|
||||||
|
echo "Deleting all data"
|
||||||
|
:: TODO: This is wrong! The idea for this check is to see if the user
|
||||||
|
:: somehow installed SRB2 in C:\. So we obviously don't want to do
|
||||||
|
:: full folder deletion
|
||||||
|
::
|
||||||
|
:: However, the %CD% == %INSTALLDIR% check doesn't work properly
|
||||||
|
:: because CD doesn't update when you change the directory?
|
||||||
|
:: So maybe it will just delete files anyway. I'm really not sure.
|
||||||
|
::
|
||||||
|
if /I ["%CD%"] == ["%INSTALLDIR%"] cd \
|
||||||
|
if /I ["%CD%"] == ["%INSTALLDIR%"] (
|
||||||
|
echo Install directory is the same as your drive root!
|
||||||
|
if /I ["%USERDIR%"] == ["%INSTALLDIR%"] (
|
||||||
|
echo Let's just delete files instead...
|
||||||
|
echo.
|
||||||
|
set DELETEALL=
|
||||||
|
goto DeleteFiles
|
||||||
|
)
|
||||||
|
set SAMEFAILSAFE=1
|
||||||
|
) else (
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
if /I ["%USERDIR%"] == ["%INSTALLDIR%"] goto AllDone
|
||||||
|
|
||||||
|
if /I ["%CD%"] == ["%USERDIR%"] cd \
|
||||||
|
if /I ["%CD%"] == ["%USERDIR%"] (
|
||||||
|
echo User data directory is the same as your drive root!
|
||||||
|
if ["%SAMEFAILSAFE%"] == ["1"] (
|
||||||
|
echo Let's just delete files instead...
|
||||||
|
echo.
|
||||||
|
set DELETEALL=
|
||||||
|
goto DeleteFiles
|
||||||
|
) else (
|
||||||
|
echo Let's not delete any user folders...
|
||||||
|
goto AllDone
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
rmdir /s /q "%USERDIR%"
|
||||||
|
if ["%SAMEFAILSAFE%"] == ["1"] (
|
||||||
|
echo Let's delete your installation files...
|
||||||
|
echo.
|
||||||
|
set DELETEALL=
|
||||||
|
goto DeleteFiles
|
||||||
|
) else (
|
||||||
|
goto AllDone
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
: DeleteFiles
|
||||||
|
|
||||||
|
for /F "usebackq tokens=*" %%A in ("%INSTALLDIR%\uninstall-list.txt") do (
|
||||||
|
if exist "%INSTALLDIR%\%%A" (
|
||||||
|
if ["%%A"] == ["%~nx0"] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
echo Deleting %INSTALLDIR%\%%A
|
||||||
|
del /q /f "%INSTALLDIR%\%%A"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
: AllDone
|
||||||
|
|
||||||
|
:: Delete the program icons
|
||||||
|
echo Deleting your program icons...
|
||||||
|
echo.
|
||||||
|
|
||||||
|
cd \
|
||||||
|
rmdir /s /q "%AppData%\Microsoft\Windows\Start Menu\Programs\Sonic Robo Blast 2"
|
||||||
|
|
||||||
|
:: Check if our install folder is non-empty
|
||||||
|
|
||||||
|
set USERDIRFILLED=
|
||||||
|
set INSTALLDIRFILLED=
|
||||||
|
for /F %%i in ('dir /b /a "%USERDIR%\*"') do (
|
||||||
|
if ["%%i"] == ["%~nx0"] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
set USERDIRFILLED=1
|
||||||
|
goto InstallFilledCheck
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
: InstallFilledCheck
|
||||||
|
|
||||||
|
if /I ["%USERDIR%"] == ["%INSTALLDIR%"] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
for /F %%i in ('dir /b /a "%INSTALLDIR%\*"') do (
|
||||||
|
if ["%%i"] == ["%~nx0"] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
set INSTALLDIRFILLED=1
|
||||||
|
goto Final
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
: Final
|
||||||
|
|
||||||
|
echo All done! Visit http://www.srb2.org if you want to play SRB2 again!
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set "FINALPROMPT=Press Enter key to exit."
|
||||||
|
if ["%USERDIRFILLED%"] == ["1"] (
|
||||||
|
echo We left your game data and mods alone, so you may delete those manually.
|
||||||
|
echo.
|
||||||
|
echo %USERDIR%
|
||||||
|
echo.
|
||||||
|
set "FINALPROMPT=Do you want to view your data? [yes/no]"
|
||||||
|
)
|
||||||
|
|
||||||
|
if ["%INSTALLDIRFILLED%"] == ["1"] (
|
||||||
|
echo We left some extra files alone in your install folder.
|
||||||
|
echo.
|
||||||
|
echo %INSTALLDIR%
|
||||||
|
echo.
|
||||||
|
set "FINALPROMPT=Do you want to view your data? [yes/no]"
|
||||||
|
)
|
||||||
|
|
||||||
|
set FINALRESPONSE=
|
||||||
|
set /p FINALRESPONSE="%FINALPROMPT% "
|
||||||
|
|
||||||
|
if ["%FINALPROMPT%"] == ["Press Enter key to exit."] (
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
if /I ["%FINALRESPONSE:~0,1%"] == ["y"] (
|
||||||
|
if ["%USERDIRFILLED%"] == ["1"] (
|
||||||
|
"%SystemRoot%\explorer.exe" "%USERDIR%"
|
||||||
|
)
|
||||||
|
if ["%INSTALLDIRFILLED%"] == ["1"] (
|
||||||
|
"%SystemRoot%\explorer.exe" "%INSTALLDIR%"
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if ["%FINALRESPONSE%"] == [""] (
|
||||||
|
if ["%USERDIRFILLED%"] == ["1"] (
|
||||||
|
"%SystemRoot%\explorer.exe" "%USERDIR%"
|
||||||
|
)
|
||||||
|
if ["%INSTALLDIRFILLED%"] == ["1"] (
|
||||||
|
"%SystemRoot%\explorer.exe" "%INSTALLDIR%"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
: DeferredDelete
|
||||||
|
|
||||||
|
cd \
|
||||||
|
|
||||||
|
:: Now let's delete our installation folder!
|
||||||
|
:: If we're not DELETEALL, just attempt to remove the install dir in case it's empty
|
||||||
|
::
|
||||||
|
:: Dummy out for now
|
||||||
|
:: if ["%DELETEALL%"] == ["1"] (
|
||||||
|
if ["0"] == ["1"] (
|
||||||
|
start "" /b "cmd" /s /c " rmdir /s /q "%INSTALLDIR%"&exit /b "
|
||||||
|
) else (
|
||||||
|
start "" /b "cmd" /s /c " del /q /f "%INSTALLDIR%\uninstall.bat"&timeout /t 2 > NUL&rmdir "%INSTALLDIR%"&exit /b "
|
||||||
|
)
|
BIN
windows-installer/sfx/7zsd_LZMA2.sfx
Normal file
BIN
windows-installer/sfx/7zsd_LZMA2.sfx
Normal file
Binary file not shown.
BIN
windows-installer/sfx/7zsd_LZMA2_x64.sfx
Normal file
BIN
windows-installer/sfx/7zsd_LZMA2_x64.sfx
Normal file
Binary file not shown.
24
windows-installer/sfx/config-installer.txt
Normal file
24
windows-installer/sfx/config-installer.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
;!@Install@!UTF-8!
|
||||||
|
|
||||||
|
GUIFlags="8+32+64+4096"
|
||||||
|
GUIMode="1"
|
||||||
|
|
||||||
|
Title="Sonic Robo Blast 2 v2.1.21"
|
||||||
|
BeginPrompt="Sonic Robo Blast 2 v2.1.21\nFull Installer\n\nSelect a folder to install SRB2 in.\n\nIf you install in AppData\\Local or Program Files, your game data will be saved to:\n%UserProfile%\\SRB2\n\nOtherwise, your game data will be in the installation folder.\n\nShortcuts will be created in your Start Menu."
|
||||||
|
|
||||||
|
ExtractPathText="Installation folder:"
|
||||||
|
InstallPath="%LocalAppData%\\SRB2"
|
||||||
|
ExtractTitle="Installing..."
|
||||||
|
ExtractDialogText="Installing SRB2 v2.1.21...\n\nCheck out our modding community!\nWe make levels, characters, and much more!\n\nVisit http://www.srb2.org/mods"
|
||||||
|
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{-opengl},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL)},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{-opengl -win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL, Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2dd.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw)},{%%T\\},{%%T\\srb2dd.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2dd.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw, Windowed)},{%%T\\},{%%T\\srb2dd.exe},{0}"
|
||||||
|
Shortcut="Pu,{cmd.exe},{/c \"%%T\\uninstall.bat\"},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{Uninstall SRB2},{%%T\\},{shell32.dll},{31}"
|
||||||
|
|
||||||
|
RunProgram="nowait:\"%%T\\new-install\\staging.bat\""
|
||||||
|
|
||||||
|
;!@InstallEnd@!
|
24
windows-installer/sfx/config-patch.txt
Normal file
24
windows-installer/sfx/config-patch.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
;!@Install@!UTF-8!
|
||||||
|
|
||||||
|
GUIFlags="8+32+64+4096"
|
||||||
|
GUIMode="1"
|
||||||
|
|
||||||
|
Title="Sonic Robo Blast 2 v2.1.21"
|
||||||
|
BeginPrompt="Sonic Robo Blast 2 v2.1.21\nPatch Installer\n\nYou must have at least v2.1.15 to use this patch.\n\nSelect your current SRB2 folder.\n\nShortcuts will be created in your Start Menu."
|
||||||
|
|
||||||
|
ExtractPathText="Current SRB2 folder:"
|
||||||
|
InstallPath="%LocalAppData%\\SRB2"
|
||||||
|
ExtractTitle="Installing..."
|
||||||
|
ExtractDialogText="Installing SRB2 v2.1.21...\n\nCheck out our modding community!\nWe make levels, characters, and much more!\n\nVisit http://www.srb2.org/mods"
|
||||||
|
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{-opengl},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL)},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2win.exe},{-opengl -win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL, Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2dd.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw)},{%%T\\},{%%T\\srb2dd.exe},{0}"
|
||||||
|
Shortcut="Pu,{%%T\\srb2dd.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw, Windowed)},{%%T\\},{%%T\\srb2dd.exe},{0}"
|
||||||
|
Shortcut="Pu,{cmd.exe},{/c \"%%T\\uninstall.bat\"},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{Uninstall SRB2},{%%T\\},{shell32.dll},{31}"
|
||||||
|
|
||||||
|
RunProgram="nowait:\"%%T\\new-install\\staging.bat\""
|
||||||
|
|
||||||
|
;!@InstallEnd@!
|
Loading…
Reference in a new issue