Merge branch 'installer-followup' into 'master'

Add old-install-list.txt to explicitly define which old install files need to be moved

See merge request STJr/SRB2!366
This commit is contained in:
Digiku 2018-12-04 01:12:21 -05:00
commit 20386d26ee
3 changed files with 68 additions and 24 deletions

View 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

View file

@ -15,11 +15,6 @@ cls
:: 3. Moves new installaton files into install folder :: 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) :: 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/ :: 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!" 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= set OLDINSTALLCHANGED=
if ["!MoveOldExesDlls!"] == ["1"] ( if exist "!STAGINGDIR!\old-install-list.txt" (
goto MoveOldInstallExeDll goto MoveOldInstallOldFiles
) else ( ) else (
goto MoveOldInstallNewFiles goto MoveOldInstallNewFiles
) )
: MoveOldInstallExeDll : MoveOldInstallOldFiles
xcopy /y /v "!INSTALLDIR!\*.exe" "!OLDINSTALLDIR!" set "TESTFILE=!TEMP!\!RANDOM!.txt"
if errorlevel 0 del /f /q "!INSTALLDIR!\*.exe"
xcopy /y /v "!INSTALLDIR!\*.dll" "!OLDINSTALLDIR!" :: Do our failsafes before copying the file in the list
if errorlevel 0 del /f /q "!INSTALLDIR!\*.dll" :: 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 ( for %%F in ("!OLDINSTALLDIR!\*") DO (
set OLDINSTALLCHANGED=1 set OLDINSTALLCHANGED=1

View file

@ -74,19 +74,23 @@ set "TESTFILE=!TEMP!\!RANDOM!.txt"
for /F "usebackq tokens=*" %%A in ("!INSTALLDIR!\uninstall-list.txt") do ( for /F "usebackq tokens=*" %%A in ("!INSTALLDIR!\uninstall-list.txt") do (
if exist "!INSTALLDIR!\%%A" ( if exist "!INSTALLDIR!\%%A" (
if ["%%A"] == ["%~nx0"] ( if ["%%A"] == [""] (
echo. echo.
) else ( ) else (
echo %%A> "!TESTFILE!" if ["%%A"] == ["%~nx0"] (
findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul echo.
if !errorlevel! equ 0 (
echo %%A has invalid characters, skipping...
) else ( ) else (
if exist "!INSTALLDIR!\%%A\*" ( echo %%A> "!TESTFILE!"
echo %%A is a folder, skipping... findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul
if !errorlevel! equ 0 (
echo %%A has invalid characters, skipping...
) else ( ) else (
echo Deleting !INSTALLDIR!\%%A if exist "!INSTALLDIR!\%%A\*" (
del /q /f "!INSTALLDIR!\%%A" echo %%A is a folder, skipping...
) else (
echo Deleting !INSTALLDIR!\%%A
del /q /f "!INSTALLDIR!\%%A"
)
) )
) )
) )