Author: nextgens Date: 2006-04-11 17:36:56 +0000 (Tue, 11 Apr 2006) New Revision: 8518
Modified: trunk/apps/installer/installclasspath/windows/update.cmd Log: installer: new winupdate script Version 1.2 is out, located at http://www.zerosplayground.dk/stuff/update.cmd as always. Changelog: - Fixed Freenet status detection for Win2k - Added zero-size checks for downloaded version information and .jar binary. - Added some misc info at the top of the script ~Zero3Cool Modified: trunk/apps/installer/installclasspath/windows/update.cmd =================================================================== --- trunk/apps/installer/installclasspath/windows/update.cmd 2006-04-11 17:28:06 UTC (rev 8517) +++ trunk/apps/installer/installclasspath/windows/update.cmd 2006-04-11 17:36:56 UTC (rev 8518) @@ -1,14 +1,17 @@ @echo off +: This script is designed for the Windows command line shell, so please don't put it into anything else! :) +: If you want to debug this script by adding pauses and stuff, please do that from another batch file, because +: if you modify this script in any way it will be detected as outdated and will be overwritten on the next run. echo ----- -echo - Freenet Windows update script by 1.1 Zero3Cool (zero3cool at zerosplayground.dk) -echo - Thanks to search4answers and Michael Schierl for help and feedback. +echo - Freenet Windows update script 1.2 by Zero3Cool (zero3cool at zerosplayground.dk) +echo - Thanks to search4answers, Michael Schierl and toad for help and feedback. echo - This script will automatically update your Freenet installation. echo - In case of an unrecoverable error, this script will pause. echo ----- set MAGICSTRING=INDO : Go to our location -for %%i in (%0) do set LOCATION=%%~dpi +for %%I in (%0) do set LOCATION=%%~dpI cd %LOCATION% : Check if its valid, or at least looks like it @@ -18,7 +21,7 @@ echo ----- : Get the filename and skip straight to the Freenet update if this is a new updater -for %%i in (%0) do set FILENAME=%%~nxi +for %%I in (%0) do set FILENAME=%%~nxI if %FILENAME%==update.new.cmd goto updaterok : Download latest updater and verify it @@ -47,6 +50,7 @@ if exist freenet-cvs-snapshot.jar.new.url del freenet-cvs-snapshot.jar.new.url bin\wget.exe -o NUL http://downloads.freenetproject.org/alpha/freenet-cvs-snapshot.jar.url -O freenet-cvs-snapshot.jar.new.url if not exist freenet-cvs-snapshot.jar.new.url goto error3 +FOR %%I IN (%LOCATION%freenet-cvs-snapshot.jar.url) DO if %%~zI==0 goto error3 : Do we have something old to compare with? If not, update right away if not exist freenet-cvs-snapshot.jar.url goto updatefreenet @@ -57,13 +61,14 @@ :updatefreenet echo - New version found, shutting down and updating Freenet... -sc query freenet-testnet|find "RUNNING" > NUL +net start | find "Freenet" > NUL if not errorlevel 1 call stop.cmd > NUL if exist freenet-cvs-snapshot.jar.url del freenet-cvs-snapshot.jar.url ren freenet-cvs-snapshot.jar.new.url freenet-cvs-snapshot.jar.url if exist freenet-cvs-snapshot.jar ren freenet-cvs-snapshot.jar freenet-cvs-snapshot.bak.jar bin\wget.exe -o NUL -i freenet-cvs-snapshot.jar.url -O freenet-cvs-snapshot.jar if not exist freenet-cvs-snapshot.jar goto error4 +FOR %%I IN (%LOCATION%freenet-cvs-snapshot.jar) DO if %%~zI==0 goto error4 echo - Freenet updated. goto end @@ -87,6 +92,7 @@ :error4 echo - Error! Freenet update failed, trying to restore backup... +if exist freenet-cvs-snapshot.jar del freenet-cvs-snapshot.jar if exist freenet-cvs-snapshot.bak.jar ren freenet-cvs-snapshot.bak.jar freenet-cvs-snapshot.jar goto end @@ -96,7 +102,7 @@ echo ----- if exist freenet-cvs-snapshot.jar.new.url del freenet-cvs-snapshot.jar.new.url if exist freenet-cvs-snapshot.bak.jar del freenet-cvs-snapshot.bak.jar -sc query freenet-testnet|find "RUNNING" > NUL +net start | find "Freenet" > NUL if errorlevel 1 call start.cmd > NUL if %FILENAME%==update.new.cmd goto newend if exist update.new.cmd del update.new.cmd @@ -108,4 +114,4 @@ exit :veryend -: FREENET WINDOWS UPDATE SCRIPT +: FREENET WINDOWS UPDATE SCRIPT \ No newline at end of file
