mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Add old-install-list.txt to explicitly define which old install files need to be moved
Replaces MoveOldExeDlls routine in installer staging
This commit is contained in:
parent
6b4f33397f
commit
7b1423a236
3 changed files with 68 additions and 24 deletions
15
windows-installer/staging/new-install/old-install-list.txt
Normal file
15
windows-installer/staging/new-install/old-install-list.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
exchndl.dll
|
||||
fmodex.dll
|
||||
libFLAC-8.dll
|
||||
libgme.dll
|
||||
libintl-8.dll
|
||||
libmikmod-2.dll
|
||||
libogg-0.dll
|
||||
libvorbis-0.dll
|
||||
libvorbisfile-3.dll
|
||||
r_opengl.dll
|
||||
SDL2.dll
|
||||
SDL2_mixer.dll
|
||||
smpeg2.dll
|
||||
srb2dd.exe
|
||||
srb2win.exe
|
|
@ -15,11 +15,6 @@ cls
|
|||
:: 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/
|
||||
|
@ -205,24 +200,54 @@ if exist "!INSTALLDIR!\old-install\*" (
|
|||
|
||||
mkdir "!OLDINSTALLDIR!"
|
||||
|
||||
:
|
||||
: Move all EXEs and DLLs
|
||||
:
|
||||
::
|
||||
:: Move all old install files
|
||||
:: We support a list of explicit files to copy to old-install
|
||||
:: And later, we also loop through our staging files, look for the pre-existing copy in
|
||||
:: install root, then copy that also to old-install
|
||||
::
|
||||
|
||||
set OLDINSTALLCHANGED=
|
||||
|
||||
if ["!MoveOldExesDlls!"] == ["1"] (
|
||||
goto MoveOldInstallExeDll
|
||||
if exist "!STAGINGDIR!\old-install-list.txt" (
|
||||
goto MoveOldInstallOldFiles
|
||||
) else (
|
||||
goto MoveOldInstallNewFiles
|
||||
)
|
||||
|
||||
: MoveOldInstallExeDll
|
||||
: MoveOldInstallOldFiles
|
||||
|
||||
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"
|
||||
set "TESTFILE=!TEMP!\!RANDOM!.txt"
|
||||
|
||||
:: Do our failsafes before copying the file in the list
|
||||
:: See uninstall.bat for details
|
||||
for /F "usebackq tokens=*" %%A in ("!STAGINGDIR!\old-install-list.txt") do (
|
||||
if exist "!INSTALLDIR!\%%A" (
|
||||
if ["%%A"] == [""] (
|
||||
echo.
|
||||
) else (
|
||||
if ["%%A"] == ["%~nx0"] (
|
||||
echo.
|
||||
) else (
|
||||
echo %%A> "!TESTFILE!"
|
||||
findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul
|
||||
if !errorlevel! equ 0 (
|
||||
echo %%A has invalid characters, skipping...
|
||||
) else (
|
||||
if exist "!INSTALLDIR!\%%A\*" (
|
||||
echo %%A is a folder, skipping...
|
||||
) else (
|
||||
echo Moving !INSTALLDIR!\%%A to "old-install" folder
|
||||
echo f | xcopy /y /v "!INSTALLDIR!\%%A" "!OLDINSTALLDIR!\%%A"
|
||||
if errorlevel 0 del /f /q "!INSTALLDIR!\%%A"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
del /q /f "!STAGINGDIR!\old-install-list.txt"
|
||||
|
||||
for %%F in ("!OLDINSTALLDIR!\*") DO (
|
||||
set OLDINSTALLCHANGED=1
|
||||
|
|
|
@ -74,19 +74,23 @@ set "TESTFILE=!TEMP!\!RANDOM!.txt"
|
|||
|
||||
for /F "usebackq tokens=*" %%A in ("!INSTALLDIR!\uninstall-list.txt") do (
|
||||
if exist "!INSTALLDIR!\%%A" (
|
||||
if ["%%A"] == ["%~nx0"] (
|
||||
if ["%%A"] == [""] (
|
||||
echo.
|
||||
) else (
|
||||
echo %%A> "!TESTFILE!"
|
||||
findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul
|
||||
if !errorlevel! equ 0 (
|
||||
echo %%A has invalid characters, skipping...
|
||||
if ["%%A"] == ["%~nx0"] (
|
||||
echo.
|
||||
) else (
|
||||
if exist "!INSTALLDIR!\%%A\*" (
|
||||
echo %%A is a folder, skipping...
|
||||
echo %%A> "!TESTFILE!"
|
||||
findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul
|
||||
if !errorlevel! equ 0 (
|
||||
echo %%A has invalid characters, skipping...
|
||||
) else (
|
||||
echo Deleting !INSTALLDIR!\%%A
|
||||
del /q /f "!INSTALLDIR!\%%A"
|
||||
if exist "!INSTALLDIR!\%%A\*" (
|
||||
echo %%A is a folder, skipping...
|
||||
) else (
|
||||
echo Deleting !INSTALLDIR!\%%A
|
||||
del /q /f "!INSTALLDIR!\%%A"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue