Author: nextgens
Date: 2006-08-01 23:19:11 +0000 (Tue, 01 Aug 2006)
New Revision: 9845

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

Modified: trunk/apps/installer/installclasspath/windows/update.cmd
===================================================================
--- trunk/apps/installer/installclasspath/windows/update.cmd    2006-08-01 
22:40:27 UTC (rev 9844)
+++ trunk/apps/installer/installclasspath/windows/update.cmd    2006-08-01 
23:19:11 UTC (rev 9845)
@@ -1,149 +1,164 @@
- at 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 it 
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.
-::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.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
-set PATH=%SYSTEMROOT%\System32\;%PATH%
-
-::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 -----
-
-if not exist wrapper.conf.bak copy wrapper.conf wrapper.conf.bak > NUL
- at del wrapper.conf
- at copy wrapper.conf.bak wrapper.conf >NUL
-
-::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 
http://downloads.freenetproject.org/alpha/update/update.cmd -O update.new.cmd
-if not exist update.new.cmd goto error1
-find "FREENET W%MAGICSTRING%WS UPDATE SCRIPT" update.new.cmd > NUL
-if errorlevel 1 goto error1
-
-::Check if updater has been updated
-fc update.cmd update.new.cmd > nul
-if not 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
-::Check for sha1test and download if needed.
-if not exist lib\sha1test.jar bin\wget.exe -o NUL 
http://downloads.freenetproject.org/alpha/installer/sha1test.jar -O 
lib\sha1test.jar
-if not errorlevel 0 goto error3
-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
-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 update1
-::Compare with current copy
-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
-:update1
-echo - New version found!
-:safetycheck
-net start | find "Freenet" > NUL
-if errorlevel 1 goto update2 > NUL
-set RESTART=1
-echo - Shutting down Freenet...
-call stop.cmd > NUL
-echo - If you see an error message about 
-echo - "The service could not be controlled in its present state."
-echo - Please ignore, it is a side effect of a work-around 
-echo - to make sure the node is stopped before we copy files.
-goto safetycheck
-
-:update2
-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
-FOR %%I IN ("%LOCATION%freenet-cvs-snapshot.jar") DO if %%~zI==0 goto error4
-java -cp lib\sha1test.jar Sha1Test freenet-cvs-snapshot.jar
-if not errorlevel 0 goto error4
-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
-echo - Freenet verified and 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.jar del freenet-cvs-snapshot.jar
-if exist freenet-cvs-snapshot.bak.jar ren freenet-cvs-snapshot.bak.jar 
freenet-cvs-snapshot.jar
-if exist freenet-cvs-snapshot.jar.url del freenet-cvs-snapshot.jar.url
-goto end
-
-:end
-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
-
-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 updater, replace it now (and force 
exit, or we will leave a command prompt open)
-:newend
-copy /Y update.new.cmd update.cmd > NUL
-echo -----
-exit
-
-:veryend
-::FREENET WINDOWS UPDATE SCRIPT
+ at 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 it 
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.
+::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.6 by Zero3Cool (zero3cool at 
zerosplayground.dk)
+echo - Freenet Windows update script 1.8 by Juiceman (juiceman69 at gmail.com)
+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 -----
+echo -----------------------------------------------------------
+echo - Please try to use the update over freenet feature of your
+echo - node to reduce traffic on our servers, thanks!!!
+echo - FYI, updating over freenet is more secure and better for
+echo - your anonymity
+echo -----------------------------------------------------------
+echo -----
+
+::Initialize some stuff
+set MAGICSTRING=INDO
+set RESTART=0
+set PATH=%SYSTEMROOT%\System32\;%PATH%
+
+::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 -----
+
+if not exist wrapper.conf.bak copy wrapper.conf wrapper.conf.bak
+del wrapper.conf
+copy wrapper.conf.bak wrapper.conf > NUL
+
+::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 --timeout=10 --waitretry=20 
http://downloads.freenetproject.org/alpha/update/update.cmd -O update.new.cmd
+
+if not exist update.new.cmd goto error1
+find "FREENET W%MAGICSTRING%WS UPDATE SCRIPT" update.new.cmd > NUL
+if errorlevel 1 goto error1
+
+::Check if updater has been updated
+fc update.cmd update.new.cmd > NUL
+if not 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
+::Check for sha1test and download if needed.
+if not exist lib\sha1test.jar bin\wget.exe -o NUL --timeout=10 --waitretry=20  
http://downloads.freenetproject.org/alpha/installer/sha1test.jar -O 
lib\sha1test.jar
+
+if not errorlevel 0 goto error3
+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 --timeout=10 --waitretry=20 
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 update1
+
+::Compare with current copy
+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
+:update1
+echo - New version found!
+:safetycheck
+net start | find "Freenet" > NUL
+if errorlevel 1 goto update2 > NUL
+set RESTART=1
+echo - Shutting down Freenet...
+call stop.cmd > NUL
+echo - If you see an error message about 
+echo - "The service could not be controlled in its present state."
+echo - Please ignore, it is a side effect of a work-around 
+echo - to make sure the node is stopped before we copy files.
+goto safetycheck
+
+:update2
+echo -----
+echo - Downloading new version and updating local installation...
+if exist freenet-cvs-snapshot.jar.bak del freenet-cvs-snapshot.jar.bak
+if exist freenet-cvs-snapshot.jar ren freenet-cvs-snapshot.jar 
freenet-cvs-snapshot.jar.bak
+bin\wget.exe -o NUL --timeout=10 --waitretry=20 -i 
freenet-cvs-snapshot.jar.new.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
+java -cp lib\sha1test.jar Sha1Test freenet-cvs-snapshot.jar
+if not errorlevel 0 goto error4
+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
+echo - Freenet-cvs-snapshot.jar verified and 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.jar del freenet-cvs-snapshot.jar
+if exist freenet-cvs-snapshot.jar.bak ren freenet-cvs-snapshot.jar.bak 
freenet-cvs-snapshot.jar
+if exist freenet-cvs-snapshot.jar.url del freenet-cvs-snapshot.jar.url
+goto end
+
+:end
+echo -----
+echo - Cleaning up...
+if exist freenet-cvs-snapshot.jar.new.url del freenet-cvs-snapshot.jar.new.url
+if exist freenet-cvs-snapshot.jar.bak del freenet-cvs-snapshot.jar.bak
+
+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 updater, replace it now (and force 
exit, or we will leave a command prompt open)
+:newend
+copy /Y update.new.cmd update.cmd > NUL
+echo -----
+exit
+
+:veryend
+::FREENET WINDOWS UPDATE SCRIPT


Reply via email to