From nextgens at freenetproject.org Sun Jun 1 03:37:08 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 03:37:08 +0000 (UTC) Subject: [freenet-cvs] r20170 - trunk/apps/new_installer/src Message-ID: <20080601033708.EAB1F4791A9@freenetproject.org> Author: nextgens Date: 2008-06-01 03:37:08 +0000 (Sun, 01 Jun 2008) New Revision: 20170 Modified: trunk/apps/new_installer/src/Sha1Test.java Log: new_installer: save one more hit per file in sha1test Modified: trunk/apps/new_installer/src/Sha1Test.java =================================================================== --- trunk/apps/new_installer/src/Sha1Test.java 2008-05-31 18:15:31 UTC (rev 20169) +++ trunk/apps/new_installer/src/Sha1Test.java 2008-06-01 03:37:08 UTC (rev 20170) @@ -88,6 +88,8 @@ if(sha1test(path + filename)) System.exit(0); get(uri, path + filename, false); + if(sha1test(path + filename)) + System.exit(0); } catch(FileNotFoundException e) { System.err.println("Not found, let's ignore that mirror."); } catch(SSLException ssle) { From nextgens at freenetproject.org Sun Jun 1 04:23:45 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 04:23:45 +0000 (UTC) Subject: [freenet-cvs] r20171 - trunk/apps/new_installer/scripts Message-ID: <20080601042345.1476D479096@freenetproject.org> Author: nextgens Date: 2008-06-01 04:23:44 +0000 (Sun, 01 Jun 2008) New Revision: 20171 Modified: trunk/apps/new_installer/scripts/update.sh Log: new_installer: simplify update.sh Modified: trunk/apps/new_installer/scripts/update.sh =================================================================== --- trunk/apps/new_installer/scripts/update.sh 2008-06-01 03:37:08 UTC (rev 20170) +++ trunk/apps/new_installer/scripts/update.sh 2008-06-01 04:23:44 UTC (rev 20171) @@ -4,8 +4,83 @@ JOPTS="-Djava.net.preferIPv4Stack=true" echo "Updating freenet" +invert_return_code () { + $* + if test $? -ne 0 + then + return 0 + else + return 1 + fi +} + +# Test if two files exist: return 0 if they *both* exist +file_exist () { + if test -n "$1" -a -n "$2" + then + if test -e "$1" -a -e "$2" + then + return 0 + fi + fi + + return 1 +} + +# Three functions used to compare files: return 0 if it matches +file_cmp_comp () { + if file_exist "$1" "$2" + then + cmp -s "$1" "$2" + return $? + else + return 1 + fi +} + +file_md5sum_comp () { + if file_exist "$1" "$2" + then + MD5_FILE1="`cat \"$1\"|md5sum`" + MD5_FILE2="`cat \"$2\"|md5sum`" + return `test "$MD5_FILE1" = "$MD5_FILE2"` + else + return 1 + fi +} + +file_sha1sum_comp () { + if file_exist "$1" "$2" + then + SHA1_FILE1="`cat \"$1\"|sha1sum`" + SHA1_FILE2="`cat \"$2\"|sha1sum`" + echo $SHA1_FILE1 $SHA1_FILE2 + return `test "$SHA1_FILE1" = "$SHA1_FILE2"` + else + return 1 + fi +} + +# Determine which one we will use +if test ! -x "`which sha1sum`" +then + if test ! -x "`which md5sum`" + then + if test ! -x "`which cmp`" + then + echo "No cmp nor md5sum nor sha1sum utility detected; Please install one of those" + exit 1 + else + CMP="invert_return_code file_cmp_comp" + fi + else + CMP="invert_return_code file_md5sum_comp" + fi +else + CMP="invert_return_code file_sha1sum_comp" +fi + # Attempt to use the auto-fetcher code, which will check the sha1sums. - if test "$#" -gt 0 then if test "$1" = "testing" @@ -24,11 +99,10 @@ # otherwise. mkdir -p download-temp - if test -d download-temp then echo Created temporary download directory. - cp *.jar *.sha1 download-temp + cp -f freenet-$RELEASE-latest.jar freenet-ext.jar freenet-$RELEASE-latest.jar.sha1 freenet-ext.jar.sha1 download-temp else echo Could not create temporary download directory. exit @@ -150,63 +224,33 @@ exit fi -cat wrapper.conf | sed 's/freenet-cvs-snapshot/freenet/g' | sed 's/freenet-stable-latest/freenet/g' | sed 's/freenet.jar.new/freenet.jar/g' | sed 's/freenet-ext.jar.new/freenet-ext.jar/g' > wrapper2.conf +# Make sure the new files will be used (necessary to prevent +# the node's auto-update to play us tricks) +cat wrapper.conf | \ + sed 's/freenet-cvs-snapshot/freenet/g' | \ + sed 's/freenet-stable-latest/freenet/g' | \ + sed 's/freenet.jar.new/freenet.jar/g' | \ + sed 's/freenet-ext.jar.new/freenet-ext.jar/g' \ + > wrapper2.conf mv wrapper2.conf wrapper.conf -if test ! -x "`which cmp`" +if $CMP freenet.jar download-temp/freenet-$RELEASE-latest.jar >/dev/null then - if test ! -x "`which md5sum`" - then - echo No cmp or md5sum utility detected - echo Restarting the node as we cannot tell whether we need to. - ./run.sh stop - mv download-temp/freenet-$RELEASE-latest.jar freenet-$RELEASE-latest.jar - rm freenet.jar - ln -s freenet-$RELEASE-latest.jar freenet.jar - mv download-temp/freenet-ext.jar freenet-ext.jar - ./run.sh start - else - if test "`md5sum freenet.jar | cut -d ' ' -f1`" != "`md5sum download-temp/freenet-$RELEASE-latest.jar | cut -d ' ' -f1`" - then - echo Restarting node because freenet-$RELEASE-latest.jar updated. - ./run.sh stop - mv download-temp/freenet-$RELEASE-latest.jar freenet-$RELEASE-latest.jar - rm freenet.jar - ln -s freenet-$RELEASE-latest.jar freenet.jar - mv download-temp/freenet-ext.jar freenet-ext.jar - ./run.sh start - elif test "`md5sum freenet-ext.jar | cut -d ' ' -f 1`" != "`md5sum download-temp/freenet-ext.jar | cut -d ' ' -f1`" - then - echo Restarting node because freenet-ext.jar updated. - ./run.sh stop - mv download-temp/freenet-ext.jar freenet-ext.jar - ./run.sh restart - else - echo Your node is up to date. - fi - fi + echo Restarting node because freenet-$RELEASE-latest.jar updated. + ./run.sh stop + cp download-temp/*.jar download-temp/*.sha1 . + rm freenet.jar + ln -s freenet-$RELEASE-latest.jar freenet.jar + ./run.sh start +elif $CMP freenet-ext.jar download-temp/freenet-ext.jar >/dev/null +then + echo Restarting node because freenet-ext.jar updated. + ./run.sh stop + cp download-temp/freenet-ext.jar* . + rm freenet.jar + ./run.sh restart else - if cmp freenet.jar download-temp/freenet-$RELEASE-latest.jar - then - # freenet.jar is up to date - if cmp download-temp/freenet-ext.jar freenet-ext.jar - then - echo Your node is up to date - else - echo Restarting node because freenet-ext.jar updated. - ./run.sh stop - mv download-temp/freenet-ext.jar freenet-ext.jar - ./run.sh start - fi - else - echo Restarting node because freenet-$RELEASE-latest.jar updated - ./run.sh stop - mv download-temp/freenet-$RELEASE-latest.jar freenet-$RELEASE-latest.jar - rm freenet.jar - ln -s freenet-$RELEASE-latest.jar freenet.jar - mv download-temp/freenet-ext.jar freenet-ext.jar - ./run.sh start - fi + echo Your node is up to date. fi rm -rf download-temp From nextgens at freenetproject.org Sun Jun 1 06:20:19 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 06:20:19 +0000 (UTC) Subject: [freenet-cvs] r20172 - trunk/freenet Message-ID: <20080601062019.06FD1479096@freenetproject.org> Author: nextgens Date: 2008-06-01 06:20:18 +0000 (Sun, 01 Jun 2008) New Revision: 20172 Modified: trunk/freenet/README Log: testing if build-scripts are working Modified: trunk/freenet/README =================================================================== --- trunk/freenet/README 2008-06-01 04:23:44 UTC (rev 20171) +++ trunk/freenet/README 2008-06-01 06:20:18 UTC (rev 20172) @@ -11,7 +11,7 @@ - Mantissa is under the modified BSD license. See README.Mantissa. According to the FSF, modified BSD is compatible with GPL; we must include both licenses. - + The installer creates a firefox profile. If you don't use it, you should have a look at user.js in the firefox_profile directory for some useful settings for browsing Freenet (both for performance and security). From nextgens at freenetproject.org Sun Jun 1 09:06:30 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 09:06:30 +0000 (UTC) Subject: [freenet-cvs] r20173 - in trunk/apps/new_installer: res/unix/bin res/windows/bin scripts src Message-ID: <20080601090630.487F6479091@freenetproject.org> Author: nextgens Date: 2008-06-01 09:06:29 +0000 (Sun, 01 Jun 2008) New Revision: 20173 Modified: trunk/apps/new_installer/res/unix/bin/install_frost.sh trunk/apps/new_installer/res/unix/bin/install_jSite.sh trunk/apps/new_installer/res/unix/bin/install_librarian.sh trunk/apps/new_installer/res/unix/bin/install_mdns.sh trunk/apps/new_installer/res/unix/bin/install_opennet.sh trunk/apps/new_installer/res/unix/bin/install_stun.sh trunk/apps/new_installer/res/unix/bin/install_thaw.sh trunk/apps/new_installer/res/unix/bin/install_thingamablog.sh trunk/apps/new_installer/res/unix/bin/install_updater.sh trunk/apps/new_installer/res/unix/bin/install_upnp.sh trunk/apps/new_installer/res/windows/bin/install_frost.cmd trunk/apps/new_installer/res/windows/bin/install_jsite.cmd trunk/apps/new_installer/res/windows/bin/install_opennet.cmd trunk/apps/new_installer/res/windows/bin/install_plugins.cmd trunk/apps/new_installer/res/windows/bin/install_thaw.cmd trunk/apps/new_installer/res/windows/bin/install_thingamablog.cmd trunk/apps/new_installer/res/windows/bin/install_updater.cmd trunk/apps/new_installer/scripts/1run.sh trunk/apps/new_installer/src/Sha1Test.java Log: new_installer: make the installer to use the new vhost... the current setup doesn't work anymore anyway :( Modified: trunk/apps/new_installer/res/unix/bin/install_frost.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_frost.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_frost.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -9,7 +9,7 @@ if test ! -e offline then echo "Downloading frost" - java $JOPTS -jar bin/sha1test.jar frost/frost.zip ./ >/dev/null 2>&1 || exit 1 + java $JOPTS -jar bin/sha1test.jar frost.zip ./ >/dev/null 2>&1 || exit 1 fi echo "Unzipping frost" mkdir frost Modified: trunk/apps/new_installer/res/unix/bin/install_jSite.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_jSite.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_jSite.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -10,6 +10,6 @@ then echo "Downloading jSite" mkdir jSite - java $JOPTS -jar bin/sha1test.jar jSite/jSite.jar jSite "$CAFILE" >/dev/null 2>&1 || exit 1 + java $JOPTS -jar bin/sha1test.jar jSite.jar jSite "$CAFILE" >/dev/null 2>&1 || exit 1 fi fi Modified: trunk/apps/new_installer/res/unix/bin/install_librarian.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_librarian.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_librarian.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -12,8 +12,7 @@ mv -f plug2 plug if test ! -e offline then - java $JOPTS -jar bin/sha1test.jar plugins/XMLLibrarian.jar.url plugins "$CAFILE" >/dev/null 2>&1 - mv plugins/XMLLibrarian.jar.url plugins/XMLLibrarian.jar + java $JOPTS -jar bin/sha1test.jar XMLLibrarian.jar plugins "$CAFILE" >/dev/null 2>&1 fi rm -f xmllibrarian fi Modified: trunk/apps/new_installer/res/unix/bin/install_mdns.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_mdns.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_mdns.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -12,8 +12,7 @@ mv -f plug2 plug if test ! -e offline then - java $JOPTS -jar bin/sha1test.jar plugins/MDNSDiscovery.jar.url plugins "$CAFILE" >/dev/null 2>&1 - mv plugins/MDNSDiscovery.jar.url plugins/MDNSDiscovery.jar + java $JOPTS -jar bin/sha1test.jar MDNSDiscovery.jar plugins "$CAFILE" >/dev/null 2>&1 fi rm -f mdns fi Modified: trunk/apps/new_installer/res/unix/bin/install_opennet.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_opennet.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_opennet.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -9,6 +9,6 @@ if test ! -e offline then echo "Downloading the Opennet seednode file" - java $JOPTS -jar bin/sha1test.jar opennet/seednodes.fref . "$CAFILE" >/dev/null 2>&1 || exit 1 + java $JOPTS -jar bin/sha1test.jar seednodes.fref . "$CAFILE" >/dev/null 2>&1 || exit 1 fi fi Modified: trunk/apps/new_installer/res/unix/bin/install_stun.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_stun.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_stun.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -12,8 +12,7 @@ mv -f plug2 plug if test ! -e offline then - java $JOPTS -jar bin/sha1test.jar plugins/JSTUN.jar.url plugins "$CAFILE" >/dev/null 2>&1 - mv plugins/JSTUN.jar.url plugins/JSTUN.jar + java $JOPTS -jar bin/sha1test.jar JSTUN.jar plugins "$CAFILE" >/dev/null 2>&1 fi rm -f stun fi Modified: trunk/apps/new_installer/res/unix/bin/install_thaw.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_thaw.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_thaw.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -10,6 +10,6 @@ then echo "Downloading Thaw" mkdir Thaw - java $JOPTS -jar bin/sha1test.jar Thaw/Thaw.jar Thaw "$CAFILE" >/dev/null 2>&1 || exit 1 + java $JOPTS -jar bin/sha1test.jar Thaw.jar Thaw "$CAFILE" >/dev/null 2>&1 || exit 1 fi fi Modified: trunk/apps/new_installer/res/unix/bin/install_thingamablog.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_thingamablog.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_thingamablog.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -9,7 +9,7 @@ if test ! -e offline then echo "Downloading thingamablog" - java $JOPTS -jar bin/sha1test.jar thingamablog/thingamablog.zip ./ "$CAFILE" >/dev/null 2>&1 || exit 1 + java $JOPTS -jar bin/sha1test.jar thingamablog.zip ./ "$CAFILE" >/dev/null 2>&1 || exit 1 fi echo "Unzipping thingamablog" java $JOPTS -jar bin/uncompress.jar thingamablog.zip . >/dev/null 2>&1 Modified: trunk/apps/new_installer/res/unix/bin/install_updater.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_updater.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_updater.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -15,7 +15,7 @@ if test ! -e offline then echo "Downloading update.sh" - java $JOPTS -jar bin/sha1test.jar update/update.sh ./ "$CAFILE" >/dev/null 2>&1 || exit 1 + java $JOPTS -jar bin/sha1test.jar update.sh ./ "$CAFILE" >/dev/null 2>&1 || exit 1 fi if test -e update.sh Modified: trunk/apps/new_installer/res/unix/bin/install_upnp.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_upnp.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/unix/bin/install_upnp.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -12,8 +12,7 @@ mv -f plug2 plug if test ! -e offline then - java $JOPTS -jar bin/sha1test.jar plugins/UPnP.jar.url plugins "$CAFILE" >/dev/null 2>&1 - mv plugins/UPnP.jar.url plugins/UPnP.jar + java $JOPTS -jar bin/sha1test.jar UPnP.jar plugins "$CAFILE" >/dev/null 2>&1 fi rm -f upnp fi Modified: trunk/apps/new_installer/res/windows/bin/install_frost.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_frost.cmd 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/windows/bin/install_frost.cmd 2008-06-01 09:06:29 UTC (rev 20173) @@ -9,7 +9,7 @@ @del /F frost.install > NUL @if exist offline goto end @echo Downloading Frost - at java -jar bin\sha1test.jar frost/frost.zip . %CAFILE% > NUL + at java -jar bin\sha1test.jar frost.zip . %CAFILE% > NUL :end @echo Setting Frost up @mkdir frost Modified: trunk/apps/new_installer/res/windows/bin/install_jsite.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_jsite.cmd 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/windows/bin/install_jsite.cmd 2008-06-01 09:06:29 UTC (rev 20173) @@ -10,8 +10,7 @@ @if exist offline goto end @echo Downloading jSite @mkdir jSite - at java -jar bin\sha1test.jar jSite/jSite.jar . %CAFILE% > NUL - at move jSite.jar jSite > NUL + at java -jar bin\sha1test.jar jSite.jar jSite %CAFILE% > NUL :end @echo @cd jSite > jsite.cmd @echo @start javaw -jar jSite.jar >> jsite.cmd Modified: trunk/apps/new_installer/res/windows/bin/install_opennet.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_opennet.cmd 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/windows/bin/install_opennet.cmd 2008-06-01 09:06:29 UTC (rev 20173) @@ -10,5 +10,5 @@ @if exist offline goto end @echo Downloading the Opennet seednode file - at java -jar bin\sha1test.jar opennet/seednodes.fref . %CAFILE% > NUL + at java -jar bin\sha1test.jar seednodes.fref . %CAFILE% > NUL :end Modified: trunk/apps/new_installer/res/windows/bin/install_plugins.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_plugins.cmd 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/windows/bin/install_plugins.cmd 2008-06-01 09:06:29 UTC (rev 20173) @@ -13,9 +13,7 @@ @echo -JSTUN @set PLUGINS=JSTUN;%PLUGINS% @if exist offline goto end1 - at java -jar bin\sha1test.jar plugins/JSTUN.jar.url plugins %CAFILE% > NUL - at if exist plugins\JSTUN.jar del /F plugins\JSTUN.jar > NUL - at move plugins\JSTUN.jar.url plugins\JSTUN.jar > NUL + at java -jar bin\sha1test.jar JSTUN.jar plugins %CAFILE% > NUL :end1 @del /F stun > NUL :nostun @@ -24,9 +22,7 @@ @echo -MDNSDiscovery @set PLUGINS=MDNSDiscovery;%PLUGINS% @if exist offline goto end2 - at java -jar bin\sha1test.jar plugins/MDNSDiscovery.jar.url plugins %CAFILE% > NUL - at if exist plugins\MDNSDiscovery.jar del /F plugins\MDNSDiscovery.jar > NUL - at move plugins\MDNSDiscovery.jar.url plugins\MDNSDiscovery.jar > NUL + at java -jar bin\sha1test.jar MDNSDiscovery.jar plugins %CAFILE% > NUL :end2 @del /F mdns > NUL :nomdns @@ -35,9 +31,7 @@ @echo -UPnP @set PLUGINS=UPnP;%PLUGINS% @if exist offline goto end3 - at java -jar bin\sha1test.jar plugins/UPnP.jar.url plugins %CAFILE% > NUL - at if exist plugins\UPnP.jar del /F plugins\UPnP.jar > NUL - at move plugins\UPnP.jar.url plugins\UPnP.jar + at java -jar bin\sha1test.jar UPnP.jar plugins %CAFILE% > NUL :end3 @del /F upnp > NUL :noupnp @@ -46,9 +40,7 @@ @echo -XMLLibrarian @set PLUGINS=XMLLibrarian;%PLUGINS% @if exist offline goto end4 - at java -jar bin\sha1test.jar plugins/XMLLibrarian.jar.url plugins %CAFILE% > NUL - at if exist plugins\XMLLibrarian.jar del /F plugins\XMLLibrarian.jar > NUL - at move plugins\XMLLibrarian.jar.url plugins\XMLLibrarian.jar + at java -jar bin\sha1test.jar XMLLibrarian.jar plugins %CAFILE% > NUL :end4 @del /F xmllibrarian > NUL :nolibrarian Modified: trunk/apps/new_installer/res/windows/bin/install_thaw.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_thaw.cmd 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/windows/bin/install_thaw.cmd 2008-06-01 09:06:29 UTC (rev 20173) @@ -10,8 +10,7 @@ @echo Downloading Thaw @if exist offline goto end @mkdir Thaw - at java -jar bin\sha1test.jar Thaw/Thaw.jar %CAFILE% > NUL - at move Thaw.jar Thaw > NUL + at java -jar bin\sha1test.jar Thaw.jar %CAFILE% > NUL :end @echo Setting Thaw up @echo @cd Thaw >thaw.cmd Modified: trunk/apps/new_installer/res/windows/bin/install_thingamablog.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_thingamablog.cmd 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/windows/bin/install_thingamablog.cmd 2008-06-01 09:06:29 UTC (rev 20173) @@ -9,7 +9,7 @@ @del /F thingamablog.install > NUL @if exist offline goto end @echo Downloading Thingamablog - at java -jar bin\sha1test.jar thingamablog/thingamablog.zip . %CAFILE% > NUL + at java -jar bin\sha1test.jar thingamablog.zip . %CAFILE% > NUL :end @echo Setting Thingamablog up @java -jar bin\uncompress.jar thingamablog.zip . > NUL Modified: trunk/apps/new_installer/res/windows/bin/install_updater.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_updater.cmd 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/res/windows/bin/install_updater.cmd 2008-06-01 09:06:29 UTC (rev 20173) @@ -7,7 +7,7 @@ @echo Downloading update.cmd @if exist offline goto end - at java -jar bin\sha1test.jar update/update.cmd . %CAFILE% > NUL + at java -jar bin\sha1test.jar update.cmd . %CAFILE% > NUL :end @echo node.updater.enabled=true>> freenet.ini Modified: trunk/apps/new_installer/scripts/1run.sh =================================================================== --- trunk/apps/new_installer/scripts/1run.sh 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/scripts/1run.sh 2008-06-01 09:06:29 UTC (rev 20173) @@ -63,10 +63,10 @@ echo "Downloading freenet-ext.jar" java -jar bin/sha1test.jar freenet-ext.jar "." $CAFILE >/dev/null || exit 1 echo "Downloading update.sh" -java -jar bin/sha1test.jar update/update.sh "." $CAFILE >/dev/null || exit 1 +java -jar bin/sha1test.jar update.sh "." $CAFILE >/dev/null || exit 1 chmod a+rx "./update.sh" echo "Downloading seednodes.fref" -java -jar bin/sha1test.jar opennet/seednodes.fref "." $CAFILE >/dev/null || exit 1 +java -jar bin/sha1test.jar seednodes.fref "." $CAFILE >/dev/null || exit 1 # Starting the node up ./run.sh start Modified: trunk/apps/new_installer/src/Sha1Test.java =================================================================== --- trunk/apps/new_installer/src/Sha1Test.java 2008-06-01 06:20:18 UTC (rev 20172) +++ trunk/apps/new_installer/src/Sha1Test.java 2008-06-01 09:06:29 UTC (rev 20173) @@ -11,6 +11,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; +import java.net.HttpURLConnection; import java.security.KeyStore; import java.security.MessageDigest; import java.security.cert.Certificate; @@ -25,8 +26,7 @@ public class Sha1Test { final static int BUFFERSIZE = 4096; - final static String BASE_DOWNLOAD_URL = "http://downloads.freenetproject.org/alpha/"; - final static String BASE_CHECKSUM_URL = "https://checksums.freenetproject.org/alpha/"; + final static String BASE_URL = "https://checksums.freenetproject.org/latest/"; static boolean useSecureMode = false; public static void main(String[] args) { @@ -168,13 +168,10 @@ BufferedOutputStream os = null; try { - if(checksum) - url = new URL((useSecureMode ? BASE_CHECKSUM_URL : BASE_DOWNLOAD_URL) + file + ".sha1"); - else - url = new URL(BASE_DOWNLOAD_URL + file); + url = new URL(BASE_URL + file + (checksum ? ".sha1" : "")); System.out.println(url); URLConnection connection = url.openConnection(); - is = connection.getInputStream(); + is = openConnectionCheckRedirects(connection); dis = new DataInputStream(new BufferedInputStream(is)); File f = new File(filename + (checksum ? ".sha1" : "")); os = new BufferedOutputStream(new FileOutputStream(f)); @@ -200,4 +197,52 @@ try { if(os != null) os.close(); } catch(IOException ioe) {} } } + + private static InputStream openConnectionCheckRedirects(URLConnection c) throws IOException + { + boolean redir; + int redirects = 0; + InputStream in = null; + do + { + if (c instanceof HttpURLConnection) + { + ((HttpURLConnection) c).setInstanceFollowRedirects(false); + } + // We want to open the input stream before getting headers + // because getHeaderField() et al swallow IOExceptions. + in = c.getInputStream(); + redir = false; + if (c instanceof HttpURLConnection) + { + HttpURLConnection http = (HttpURLConnection) c; + int stat = http.getResponseCode(); + if (stat >= 300 && stat <= 307 && stat != 306 && + stat != HttpURLConnection.HTTP_NOT_MODIFIED) + { + URL base = http.getURL(); + String loc = http.getHeaderField("Location"); + URL target = null; + if (loc != null) + { + target = new URL(base, loc); + } + http.disconnect(); + // Redirection should be allowed only for HTTP and HTTPS + // and should be limited to 5 redirections at most. + if (target == null || !(target.getProtocol().equals("http") + || target.getProtocol().equals("https")) + || redirects >= 5) + { + throw new SecurityException("illegal URL redirect"); + } + redir = true; + c = target.openConnection(); + redirects++; + } + } + } + while (redir); + return in; + } } From nextgens at freenetproject.org Sun Jun 1 09:21:58 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 09:21:58 +0000 (UTC) Subject: [freenet-cvs] r20174 - trunk/apps/new_installer/res/windows/bin Message-ID: <20080601092158.33D4A478184@freenetproject.org> Author: nextgens Date: 2008-06-01 09:21:57 +0000 (Sun, 01 Jun 2008) New Revision: 20174 Modified: trunk/apps/new_installer/res/windows/bin/install_thaw.cmd Log: new_installer: doh Modified: trunk/apps/new_installer/res/windows/bin/install_thaw.cmd =================================================================== --- trunk/apps/new_installer/res/windows/bin/install_thaw.cmd 2008-06-01 09:06:29 UTC (rev 20173) +++ trunk/apps/new_installer/res/windows/bin/install_thaw.cmd 2008-06-01 09:21:57 UTC (rev 20174) @@ -10,7 +10,7 @@ @echo Downloading Thaw @if exist offline goto end @mkdir Thaw - at java -jar bin\sha1test.jar Thaw.jar %CAFILE% > NUL + at java -jar bin\sha1test.jar Thaw.jar Thaw %CAFILE% > NUL :end @echo Setting Thaw up @echo @cd Thaw >thaw.cmd From nextgens at freenetproject.org Sun Jun 1 11:52:42 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 11:52:42 +0000 (UTC) Subject: [freenet-cvs] r20175 - trunk/apps/new_installer/scripts Message-ID: <20080601115242.0FD17478987@freenetproject.org> Author: nextgens Date: 2008-06-01 11:52:41 +0000 (Sun, 01 Jun 2008) New Revision: 20175 Modified: trunk/apps/new_installer/scripts/update.cmd Log: new_installer: remove old backward-compatibility code in update.cmd Modified: trunk/apps/new_installer/scripts/update.cmd =================================================================== --- trunk/apps/new_installer/scripts/update.cmd 2008-06-01 09:21:57 UTC (rev 20174) +++ trunk/apps/new_installer/scripts/update.cmd 2008-06-01 11:52:41 UTC (rev 20175) @@ -102,27 +102,6 @@ echo - Freenet installation found at %LOCATION% echo ----- - -:: Register .fref file extention -if exist fref.reg goto regupdated -echo - Registering .fref file extention - -echo Windows Registry Editor Version 5.00 >> fref.reg -echo [HKEY_CLASSES_ROOT\.fref] >> fref.reg -echo @="fref_auto_file" >> fref.reg -echo [HKEY_CLASSES_ROOT\fref_auto_file] >> fref.reg -echo @="Freenet node reference" >> fref.reg -echo "EditFlags"=dword:00000000 >> fref.reg -echo "BrowserFlags"=dword:00000008 >> fref.reg -echo [HKEY_CLASSES_ROOT\fref_auto_file\DefaultIcon] >> fref.reg -echo @="shell32.dll,56" >> fref.reg -echo [HKEY_CLASSES_ROOT\fref_auto_file\shell] >> fref.reg -echo @="Open" >> fref.reg -regedit /s fref.reg > NUL -FTYPE fref_auto_file=start javaw -cp "%LOCATION%\freenet.jar" freenet.tools.AddRef "%%1" > NUL -:regupdated - -echo ----- echo - Checking for Freenet JAR updates... ::Check for sha1test and download if needed. @@ -130,14 +109,6 @@ if not exist lib\sha1test.jar bin\wget.exe -o NUL -c --timeout=5 --tries=5 --waitretry=10 http://downloads.freenetproject.org/alpha/installer/sha1test.jar -O lib\sha1test.jar if not errorlevel 0 goto error3 -:: Disable password expiration on freenet's account -if exist bin\netuser.exe goto pwupdated - at java -cp lib\sha1test.jar Sha1Test installer/netuser.exe > NUL - at move netuser.exe bin\ > NUL -if not errorlevel 0 goto error3 - at bin\netuser.exe freenet /pwnexp:y >NUL -:pwupdated - if exist freenet-%RELEASE%-latest.jar.new.url del freenet-%RELEASE%-latest.jar.new.url bin\wget.exe -o NUL -c --timeout=5 --tries=5 --waitretry=10 http://downloads.freenetproject.org/alpha/freenet-%RELEASE%-latest.jar.url -O freenet-%RELEASE%-latest.jar.new.url Title Freenet Update Over HTTP Script From nextgens at freenetproject.org Sun Jun 1 12:07:41 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 12:07:41 +0000 (UTC) Subject: [freenet-cvs] r20176 - trunk/apps/new_installer/scripts Message-ID: <20080601120741.9E242478EDD@freenetproject.org> Author: nextgens Date: 2008-06-01 12:07:41 +0000 (Sun, 01 Jun 2008) New Revision: 20176 Modified: trunk/apps/new_installer/scripts/update.cmd Log: new_installer: make update.cmd use the SSL certificate if possible (should be compatible with old versions too as they will ignore the parameter) Modified: trunk/apps/new_installer/scripts/update.cmd =================================================================== --- trunk/apps/new_installer/scripts/update.cmd 2008-06-01 11:52:41 UTC (rev 20175) +++ trunk/apps/new_installer/scripts/update.cmd 2008-06-01 12:07:41 UTC (rev 20176) @@ -36,6 +36,7 @@ ::Initialize some stuff set MAGICSTRING=INDO +set CAFILE=startssl.pem set RESTART=0 set PATH=%SYSTEMROOT%\System32\;%PATH% set RELEASE=stable @@ -166,7 +167,7 @@ if not exist freenet-%RELEASE%-latest.jar goto error4 FOR %%I IN ("%LOCATION%freenet-%RELEASE%-latest.jar") DO if %%~zI==0 goto error4 ::Test the new jar file for integrity. -java -cp lib\sha1test.jar Sha1Test freenet-%RELEASE%-latest.jar > NUL +java -cp lib\sha1test.jar Sha1Test freenet-%RELEASE%-latest.jar . %CAFILE% > NUL if not errorlevel 0 goto error4 ::Everything looks good, lets install it copy freenet-%RELEASE%-latest.jar freenet.jar > NUL From nextgens at freenetproject.org Sun Jun 1 13:30:08 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Sun, 1 Jun 2008 13:30:08 +0000 (UTC) Subject: [freenet-cvs] r20177 - trunk/apps/new_installer/scripts Message-ID: <20080601133008.D7F52478EDD@freenetproject.org> Author: nextgens Date: 2008-06-01 13:30:08 +0000 (Sun, 01 Jun 2008) New Revision: 20177 Modified: trunk/apps/new_installer/scripts/update.sh Log: doh Modified: trunk/apps/new_installer/scripts/update.sh =================================================================== --- trunk/apps/new_installer/scripts/update.sh 2008-06-01 12:07:41 UTC (rev 20176) +++ trunk/apps/new_installer/scripts/update.sh 2008-06-01 13:30:08 UTC (rev 20177) @@ -189,7 +189,7 @@ fi fi -if java $JOPTS -cp sha1test.jar Sha1Test update/update.sh ./ $CAFILE +if java $JOPTS -cp sha1test.jar Sha1Test update.sh ./ $CAFILE then echo "Downloaded update.sh" chmod +x update.sh From nextgens at freenetproject.org Mon Jun 2 13:55:05 2008 From: nextgens at freenetproject.org (nextgens at freenetproject.org) Date: Mon, 2 Jun 2008 13:55:05 +0000 (UTC) Subject: [freenet-cvs] r20178 - in trunk/apps/new_installer: res/unix/bin scripts Message-ID: <20080602135505.8C0A4479563@freenetproject.org> Author: nextgens Date: 2008-06-02 13:55:05 +0000 (Mon, 02 Jun 2008) New Revision: 20178 Modified: trunk/apps/new_installer/res/unix/bin/install_autostart.sh trunk/apps/new_installer/scripts/1run.sh Log: new_installer: make the headless installer set a crontab up too Modified: trunk/apps/new_installer/res/unix/bin/install_autostart.sh =================================================================== --- trunk/apps/new_installer/res/unix/bin/install_autostart.sh 2008-06-01 13:30:08 UTC (rev 20177) +++ trunk/apps/new_installer/res/unix/bin/install_autostart.sh 2008-06-02 13:55:05 UTC (rev 20178) @@ -14,17 +14,19 @@ then echo "Installing cron job to start Freenet on reboot..." crontab -l 2>/dev/null > autostart.install - echo "@reboot \"$INSTALL_PATH/run.sh\" start 2>&1 >/dev/null #FREENET AUTOSTART - 8888" >> autostart.install + echo "@reboot \"$PWD/run.sh\" start 2>&1 >/dev/null #FREENET AUTOSTART - 8888" >> autostart.install if crontab autostart.install then echo Installed cron job. - else - echo Could not install cron job, you will have to run run.sh start manually to start Freenet after a reboot. fi + fi + + if test -s autostart.install + then + rm -f autostart.install else echo Cron appears not to be installed, you will have to run run.sh start manually to start Freenet after a reboot. fi else echo Auto-start is disabled, you will have to run run.sh start manually to start Freenet after a reboot. fi -rm -f autostart.install Modified: trunk/apps/new_installer/scripts/1run.sh =================================================================== --- trunk/apps/new_installer/scripts/1run.sh 2008-06-01 13:30:08 UTC (rev 20177) +++ trunk/apps/new_installer/scripts/1run.sh 2008-06-02 13:55:05 UTC (rev 20178) @@ -1,18 +1,19 @@ #!/bin/sh -if test ! -s bin/1run.sh +if test -s freenet.ini then - echo 'This script should be started using ./bin/1run.sh!' + echo "This script isn\'t meant to be used more than once." + rm -f bin/1run.sh exit fi -if test -s freenet.ini +if test ! -s bin/1run.sh then - echo "This script isn\'t meant to be used more than once." - rm -f bin/1run.sh + echo 'This script should be started using ./bin/1run.sh!' exit fi + CAFILE="startssl.pem" # We need the exec flag on /bin @@ -68,6 +69,24 @@ echo "Downloading seednodes.fref" java -jar bin/sha1test.jar seednodes.fref "." $CAFILE >/dev/null || exit 1 +if test -x `which crontab` +then + echo "Installing cron job to start Freenet on reboot..." + crontab -l 2>/dev/null > autostart.install + echo "@reboot \"$PWD/run.sh\" start 2>&1 >/dev/null #FREENET AUTOSTART - $FPROXY_PORT" >> autostart.install + if crontab autostart.install + then + echo Installed cron job. + fi +fi + +if test -s autostart.install +then + rm -f autostart.install +else + echo Cron appears not to be installed, you will have to run run.sh start manually to start Freenet after a reboot. +fi + # Starting the node up ./run.sh start From j16sdiz at freenetproject.org Mon Jun 2 13:57:31 2008 From: j16sdiz at freenetproject.org (j16sdiz at freenetproject.org) Date: Mon, 2 Jun 2008 13:57:31 +0000 (UTC) Subject: [freenet-cvs] r20179 - branches/saltedhashstore/freenet/src/freenet/store Message-ID: <20080602135731.8E17347955F@freenetproject.org> Author: j16sdiz Date: 2008-06-02 13:57:31 +0000 (Mon, 02 Jun 2008) New Revision: 20179 Modified: branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java Log: doh Modified: branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java =================================================================== --- branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java 2008-06-02 13:55:05 UTC (rev 20178) +++ branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java 2008-06-02 13:57:31 UTC (rev 20179) @@ -1142,9 +1142,10 @@ } public void setBloomSync(boolean sync) { - lockGlobal(30000); - this.syncBloom = sync; - unlockGlobal(); + if (lockGlobal(Integer.MAX_VALUE)) { + this.syncBloom = sync; + unlockGlobal(); + } } // ------------- Locking From j16sdiz at freenetproject.org Mon Jun 2 13:57:55 2008 From: j16sdiz at freenetproject.org (j16sdiz at freenetproject.org) Date: Mon, 2 Jun 2008 13:57:55 +0000 (UTC) Subject: [freenet-cvs] r20180 - branches/saltedhashstore/freenet/src/freenet/store Message-ID: <20080602135755.C330247956D@freenetproject.org> Author: j16sdiz Date: 2008-06-02 13:57:55 +0000 (Mon, 02 Jun 2008) New Revision: 20180 Modified: branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java Log: import and indent Modified: branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java =================================================================== --- branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java 2008-06-02 13:57:31 UTC (rev 20179) +++ branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java 2008-06-02 13:57:55 UTC (rev 20180) @@ -28,23 +28,21 @@ import freenet.support.HexUtil; import freenet.support.Logger; import freenet.support.io.FileUtil; -import freenet.support.math.RunningAverage; -import freenet.support.math.SimpleRunningAverage; /** * Index-less data store based on salted hash - * + * * @author sdiz */ public class SaltedHashFreenetStore implements FreenetStore { private static final boolean OPTION_SAVE_PLAINKEY = true; private static final int OPTION_MAX_PROBE = 4; - + private static final boolean updateBloom = true; private static final boolean checkBloom = true; private boolean syncBloom = true; private BloomFilter bloomFilter; - + private static final boolean logLOCK = false; private static boolean logMINOR; private static boolean logDEBUG; @@ -94,7 +92,7 @@ loadConfigFile(); openStoreFiles(baseDir, name); - + if (updateBloom || checkBloom) bloomFilter = new BloomFilter(new File(this.baseDir, name + ".bloom"), 0x4000000, 4); @@ -108,7 +106,7 @@ public StorableBlock fetch(byte[] routingKey, byte[] fullKey, boolean dontPromote) throws IOException { if (logMINOR) Logger.minor(this, "Fetch " + HexUtil.bytesToHex(routingKey) + " for " + callback); - + Entry entry = probeEntry(routingKey); if (entry == null) { @@ -117,7 +115,7 @@ } unlockEntry(entry.curOffset); - + try { StorableBlock block = entry.getStorableBlock(routingKey, fullKey); incHits(); @@ -134,7 +132,7 @@ /** * Find and lock an entry with a specific routing key. You have to unlock the entry * explicitly yourself! - * + * * @param routingKey * @return Entry object * @throws IOException @@ -280,7 +278,7 @@ /** * Data entry - * + * *
 	 *       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 *       |0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|
@@ -305,7 +303,7 @@
 	 *  |    |           Padding             |
 	 *  +----+-------------------------------+
 	 * 
- * + * * Total length is padded to multiple of 512bytes. All reserved bytes should be zero when * written, ignored on read. */ @@ -323,7 +321,7 @@ /** * Create a new entry - * + * * @param plainRoutingKey * @param header * @param data @@ -446,7 +444,7 @@ /** * Verify and decrypt this entry - * + * * @param routingKey * @return true if the routeKey match and the entry is decrypted. */ @@ -533,7 +531,7 @@ /** * Open all store files - * + * * @param baseDir * @param name * @throws IOException @@ -572,7 +570,7 @@ /** * Read entry from disk. - * + * * Before calling this function, you should acquire all required locks. */ private Entry readEntry(long offset, byte[] routingKey) throws IOException { @@ -601,7 +599,7 @@ /** * Write entry to disk. - * + * * Before calling this function, you should: *