Author: toad Date: 2006-04-24 17:41:12 +0000 (Mon, 24 Apr 2006) New Revision: 8573
Modified: trunk/apps/installer/installclasspath/windows/update.cmd Log: Version 1.6 of the updater script from Zero3Cool. Supports automatic restarting of the node if the jar has been updated. Modified: trunk/apps/installer/installclasspath/windows/update.cmd =================================================================== --- trunk/apps/installer/installclasspath/windows/update.cmd 2006-04-24 14:41:02 UTC (rev 8572) +++ trunk/apps/installer/installclasspath/windows/update.cmd 2006-04-24 17:41:12 UTC (rev 8573) @@ -4,12 +4,15 @@ ::if you modify this script in any way it will be detected as outdated and will be overwritten on the next run. ::To force a re-download of the latest Freenet .jar, simply delete freenet-cvs-snapshot.jar.url before running this script. echo ----- -echo - Freenet Windows update script 1.5 by Zero3Cool (zero3cool at zerosplayground.dk) +echo - Freenet Windows update script 1.6 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 ----- + +::Initialize some stuff set MAGICSTRING=INDO +set RESTART=0 ::Go to our location for %%I in (%0) do set LOCATION=%%~dpI @@ -60,10 +63,17 @@ fc freenet-cvs-snapshot.jar.url freenet-cvs-snapshot.jar.new.url > nul if not errorlevel 1 goto noupdate +::New version found, check if the node is currently running :updatefreenet -echo - New version found, shutting down and updating Freenet... +echo - New version found! net start | find "Freenet" > NUL -if not errorlevel 1 call stop.cmd > NUL +if errorlevel 1 goto updatefreenet2 > NUL +set RESTART=1 +echo - Shutting down Freenet... +call stop.cmd > NUL + +:updatefreenet2 +echo - Downloading new version and updating local installation... 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.new.url -O freenet-cvs-snapshot.jar if not exist freenet-cvs-snapshot.jar goto error4 @@ -99,19 +109,24 @@ :end echo ----- -echo - Cleaning up and restarting Freenet... -echo ----- +echo - Cleaning up... 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 -net start | find "Freenet" > NUL -if errorlevel 1 call start.cmd > NUL + +if %RESTART%==0 goto cleanup2 +echo - Restarting Freenet... +call start.cmd > NUL + +:cleanup2 if %FILENAME%==update.new.cmd goto newend if exist update.new.cmd del update.new.cmd +echo ----- goto veryend -::If this session was launched by an old update, replace the original updater now (and force exit, or we will leave a command promt open) +::If this session was launched by an old updater, replace it now (and force exit, or we will leave a command promt open) :newend copy /Y update.new.cmd update.cmd > NUL +echo ----- exit :veryend
