Author: nextgens
Date: 2006-04-10 08:43:06 +0000 (Mon, 10 Apr 2006)
New Revision: 8502

Modified:
   trunk/apps/installer/installclasspath/windows/update.cmd
Log:
installer: new update script for windows
from Zero3Cool :

New version (1.1) is out, changelog:
- Removed OS check (nextgens you removed it from version 1.0, so i blame
you if people whine about it now :P)
- Fixed command promt staying open after an updater update
- Added backup routine to the .jar update. If wget fails to download the
latest version, the current will be restored.
- Fixed updater validation accepting its own routine as the
identification line.
- Various tweaks/fixes/typo corrections/...


Modified: trunk/apps/installer/installclasspath/windows/update.cmd
===================================================================
--- trunk/apps/installer/installclasspath/windows/update.cmd    2006-04-09 
10:22:53 UTC (rev 8501)
+++ trunk/apps/installer/installclasspath/windows/update.cmd    2006-04-10 
08:43:06 UTC (rev 8502)
@@ -1,101 +1,111 @@
- at echo off
-echo -----
-echo - Freenet windows update script by 1.0 Zero3Cool (zero3cool at 
zerosplayground.dk)
-echo - This script will automatically update your Freenet installation.
-echo - In case of a serious error, this script will pause.
-echo -----
-
-: Go to our location
-for %%i in (%0) do set LOCATION=%%~dpi
-cd %LOCATION%
-
-: Check if its valid, or at least looks like it
-if not exist freenet.ini goto error2
-if not exist bin\wget.exe goto error2
-echo - Freenet installation found at %LOCATION%
-echo -----
-
-: Clean up after old update
-if exist freenet-cvs-snapshot.jar.new.url del freenet-cvs-snapshot.jar.new.url
-
-: Is this session launched by an old updater? If so, don't try to update again 
this session
-for %%i in (%0) do set FILENAME=%%~nxi
-if %FILENAME%==update.new.cmd goto updaterok
-
-: Download latest updater and verify it
-echo - Checking for updater updates...
-bin\wget.exe -o NUL 
https://emu.freenetproject.org/svn/trunk/apps/installer/installclasspath/windows/update.cmd
 -O update.new.cmd
-if not exist update.new.cmd goto error1
-type update.new.cmd|find "FREENET WINDOWS UPDATE SCRIPT" > NUL
-if errorlevel 1 goto error1
-
-: Check if updater has been updated
-fc update.cmd update.new.cmd|find "***** " > nul
-if errorlevel 1 goto updaterok
-
-: It has! Update self and run again...
-echo - Updater updated, restarting update...
-start update.new.cmd
-goto veryend
-
-: Updater is up to date, check Freenet
-:updaterok
-echo - Updater is up to date.
-echo -----
-echo - Checking for Freenet updates...
-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
-
-: Do we have something old to compare with? If not, update right away
-if not exist freenet-cvs-snapshot.jar.url goto updatefreenet
-
-: Compare with current copy
-fc freenet-cvs-snapshot.jar.url freenet-cvs-snapshot.jar.new.url|find "***** " 
> nul
-if errorlevel 1 goto noupdate
-
-:updatefreenet
-echo - New version found, shutting down and updating Freenet...
-sc query freenet-testnet|find "RUNNING" > 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
-bin\wget.exe -o NUL -i freenet-cvs-snapshot.jar.url -O freenet-cvs-snapshot.jar
-echo - Freenet updated.
-goto end
-
-:noupdate
-echo - Freenet is up to date.
-goto end
-
-:error0
-echo - Error! Your OS is not supported by this update script.
-echo -----
-pause
-goto veryend
-
-:error1
-echo - Error! Downloaded update script is invalid. Try again later.
-goto end
-
-:error2
-echo - Error! Please run this script from a working Freenet installation.
-echo -----
-pause
-goto veryend
-
-:error3
-echo - Error! Could not download latest Freenet update information. Try again 
later.
-goto end
-
-:end
-echo -----
-echo - Cleaning up and restarting Freenet...
-echo -----
-if exist freenet-cvs-snapshot.jar.new.url del freenet-cvs-snapshot.jar.new.url
-sc query freenet-testnet|find "RUNNING" > NUL
-if errorlevel 1 call start.cmd > NUL
-if %FILENAME%==update.new.cmd copy /Y update.new.cmd update.cmd > NUL
-if exist update.new.cmd del update.new.cmd
-
-:veryend
-: FREENET WINDOWS UPDATE SCRIPT
+ at echo off
+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 - 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
+cd %LOCATION%
+
+: Check if its valid, or at least looks like it
+if not exist freenet.ini goto error2
+if not exist bin\wget.exe goto error2
+echo - Freenet installation found at %LOCATION%
+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
+if %FILENAME%==update.new.cmd goto updaterok
+
+: Download latest updater and verify it
+if exist update.new.cmd del update.new.cmd
+echo - Checking for updater updates...
+bin\wget.exe -o NUL 
https://emu.freenetproject.org/svn/trunk/apps/installer/installclasspath/windows/update.cmd
 -O update.new.cmd
+if not exist update.new.cmd goto error1
+type update.new.cmd|find "FREENET W%MAGICSTRING%WS UPDATE SCRIPT" > NUL
+if errorlevel 1 goto error1
+
+: Check if updater has been updated
+fc update.cmd update.new.cmd|find "***** " > nul
+if errorlevel 1 goto updaterok
+
+: It has! Run new version and end self
+echo - Updater updated, restarting update...
+echo -----
+start update.new.cmd
+goto veryend
+
+: Updater is up to date, check Freenet
+:updaterok
+echo - Updater is up to date.
+echo -----
+echo - Checking for Freenet updates...
+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
+
+: Do we have something old to compare with? If not, update right away
+if not exist freenet-cvs-snapshot.jar.url goto updatefreenet
+
+: Compare with current copy
+fc freenet-cvs-snapshot.jar.url freenet-cvs-snapshot.jar.new.url|find "***** " 
> nul
+if errorlevel 1 goto noupdate
+
+:updatefreenet
+echo - New version found, shutting down and updating Freenet...
+sc query freenet-testnet|find "RUNNING" > 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
+echo - Freenet updated.
+goto end
+
+:noupdate
+echo - Freenet is up to date.
+goto end
+
+:error1
+echo - Error! Downloaded update script is invalid. Try again later.
+goto end
+
+:error2
+echo - Error! Please run this script from a working Freenet installation.
+echo -----
+pause
+goto veryend
+
+:error3
+echo - Error! Could not download latest Freenet update information. Try again 
later.
+goto end
+
+:error4
+echo - Error! Freenet update failed, trying to restore backup...
+if exist freenet-cvs-snapshot.bak.jar ren freenet-cvs-snapshot.bak.jar 
freenet-cvs-snapshot.jar
+goto end
+
+:end
+echo -----
+echo - Cleaning up and restarting Freenet...
+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
+if errorlevel 1 call start.cmd > NUL
+if %FILENAME%==update.new.cmd goto newend
+if exist update.new.cmd del update.new.cmd
+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)
+:newend
+copy /Y update.new.cmd update.cmd > NUL
+exit
+
+:veryend
+: FREENET WINDOWS UPDATE SCRIPT


Reply via email to