Author: nextgens
Date: 2006-08-07 13:35:57 +0000 (Mon, 07 Aug 2006)
New Revision: 9944
Modified:
trunk/apps/new_installer/TODO
trunk/apps/new_installer/build.xml
trunk/apps/new_installer/res/unix/bin/1run.sh
trunk/apps/new_installer/res/windows/bin/1run.cmd
Log:
installer: detect if the proxy|fcp|console ports are bindable or not,
workaround if not
Modified: trunk/apps/new_installer/TODO
===================================================================
--- trunk/apps/new_installer/TODO 2006-08-06 16:45:48 UTC (rev 9943)
+++ trunk/apps/new_installer/TODO 2006-08-07 13:35:57 UTC (rev 9944)
@@ -1,6 +1,5 @@
TODO:
* l10n
- * x86_64 support
- * more support for unix
* Fix uninstallation hooks
* New packs:
+ -Freemail
Modified: trunk/apps/new_installer/build.xml
===================================================================
--- trunk/apps/new_installer/build.xml 2006-08-06 16:45:48 UTC (rev 9943)
+++ trunk/apps/new_installer/build.xml 2006-08-07 13:35:57 UTC (rev 9944)
@@ -14,7 +14,7 @@
<taskdef name="izpack"
classpath="${basedir}/lib/standalone-compiler.jar"
classname="com.izforge.izpack.ant.IzPackTask"/>
- <target name="dist" description="generate the distribution"
depends="compile_sha1test, compile_browser, compile_uncompress">
+ <target name="dist" description="generate the distribution"
depends="compile_sha1test, compile_browser, compile_uncompress,
compile_bindtest">
<echo message="Build the installer"/>
<izpack input="${config}" output="${dest}"
baseDir="${basedir}"/>
</target>
@@ -26,6 +26,7 @@
<delete dir="${build}_sha1test"/>
<delete dir="${build}_browser"/>
<delete dir="${build}_uncompress"/>
+ <delete dir="${build}_bindtest"/>
<delete file="freenet-win32.exe"/>
<delete file="freenet-win32-with_jre.exe"/>
<delete file="jre.exe"/>
@@ -85,6 +86,22 @@
</jar>
</target>
+ <target name="compile_bindtest">
+ <!-- Create the time stamp -->
+ <tstamp/>
+ <!-- Create the build directory structure used by compile -->
+
+ <mkdir dir="${build}_bindtest"/>
+ <javac srcdir="./src" destdir="./${build}_bindtest"
optimize="on" source="1.4">
+ <include name="BindTest.java"/>
+ </javac>
+ <jar jarfile="./res/bin/bindtest.jar"
basedir="./${build}_bindtest">
+ <manifest>
+ <attribute name="Main-Class" value="BindTest"/>
+ </manifest>
+ </jar>
+ </target>
+
<target name="win32" depends="dist">
<copy file="res/installer.exe" tofile="freenet-win32.exe"/>
<exec executable="rar">
Modified: trunk/apps/new_installer/res/unix/bin/1run.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/1run.sh 2006-08-06 16:45:48 UTC
(rev 9943)
+++ trunk/apps/new_installer/res/unix/bin/1run.sh 2006-08-07 13:35:57 UTC
(rev 9944)
@@ -4,10 +4,12 @@
echo "install: $INSTALL_PATH"
cd "$DST"
+
+# Tweak freenet.ini before the first startup
if [[ -e stun ]]
then
echo "Enabling the STUN plugin"
- echo
"pluginmanager.loadplugin=*@file://$INSTALL_PATH/plugins/JSTUN.jar;" >>
freenet.ini
+ echo "pluginmanager.loadplugin=plugins.JSTUN at
file://$INSTALL_PATH/plugins/JSTUN.jar;" >> freenet.ini
rm -f stun
fi
if [[ -e update ]]
@@ -17,6 +19,43 @@
rm -f update
fi
+# Try to auto-detect the first aviable port for fproxy
+FPROXY_PORT=8888
+java -jar bin/bindtest.jar $FPROXY_PORT
+if [[ $? -ne 0 ]]
+then
+ FPROXY_PORT=8889
+ echo "Can not bind fproxy to 8888: let's try $FPROXY_PORT insteed."
+ java -jar bin/bindtest.jar $FPROXY_PORT
+ if [[ $? -ne 0 ]]
+ then
+ FPROXY_PORT=9999
+ echo "Can not bind fproxy to 8889: force it to $FPROXY_PORT
insteed. You might have to edit freenet.ini by hand yourself to choose an
aviable, bindable tcp port."
+ fi
+fi
+echo -e "fproxy.enabled=true\nfproxy.port=$FPROXY_PORT" >> freenet.ini
+
+# Try to auto-detect the first aviable port for fcp
+FCP_PORT=9481
+java -jar bin/bindtest.jar $FCP_PORT
+if [[ $? -ne 0 ]]
+then
+ FCP_PORT=9482
+ echo "Can not bind fcp to 9481: force it to $FCP_PORT insteed. You
might have to edit freenet.ini by hand yourself to choose an aviable, bindable
tcp port."
+fi
+echo -e "fcp.enabled=true\nfcp.port=$FCP_PORT" >> freenet.ini
+
+# Try to auto-detect the first aviable port for console
+CONSOLE_PORT=2323
+java -jar bin/bindtest.jar $CONSOLE_PORT
+if [[ $? -ne 0 ]]
+then
+ CONSOLE_PORT=2324
+ echo "Can not bind console to 2323: force it to $CONSOLE_PORT insteed.
You might have to edit freenet.ini by hand yourself to choose an aviable,
bindable tcp port."
+fi
+echo -e "console.enabled=true\nconsole.port=$CONSOLE_PORT" >> freenet.ini
+
+# We need the exec flag on /bin
chmod a+rx -R $INSTALL_PATH/bin $INSTALL_PATH/lib
echo "Downloading freenet-stable-latest.jar"
@@ -26,12 +65,14 @@
echo "Downloading update.sh"
java -jar bin/sha1test.jar update/update.sh "$DST" || exit 1
chmod +x $DST/update.sh
+
+# Starting the node up
./run.sh start
echo "Waiting for Freenet to startup"
sleep 10
echo "Starting up a browser"
-java -cp bin/browser.jar BareBonesBrowserLaunch "http://127.0.0.1:8888/"
-java -cp bin/browser.jar BareBonesBrowserLaunch
"http://$INSTALL_PATH/welcome.html"
+java -cp bin/browser.jar BareBonesBrowserLaunch
"http://127.0.0.1:$FPROXY_PORT/"
+java -cp bin/browser.jar BareBonesBrowserLaunch
"file:///$INSTALL_PATH/welcome.html"
echo "Finished"
Modified: trunk/apps/new_installer/res/windows/bin/1run.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/bin/1run.cmd 2006-08-06 16:45:48 UTC
(rev 9943)
+++ trunk/apps/new_installer/res/windows/bin/1run.cmd 2006-08-07 13:35:57 UTC
(rev 9944)
@@ -1,9 +1,33 @@
@set PATH=%SYSTEMROOT%\System32\;%PATH%
@cd "$INSTALL_PATH"
+
+:: Tweak freenet.ini
@if exist stun echo pluginmanager.loadplugin=plugins.JSTUN at
file:///$INSTALL_PATH\plugins\JSTUN.jar >> freenet.ini
@del /F stun > NUL
@if exist update echo node.updater.autoupdate=true >> freenet.ini
@del /F update > NUL
+
+:: Try to detect a free, aviable port for fproxy
+ at set FPROXY_PORT=8888
+ at java -jar bin\bindtest.java %FPROXY_PORT%
+ at if not errorlevel 0 set FPROXY_PORT=8889
+ at echo fproxy.enable=true >>freenet.ini
+ at echo fproxy.port=%FPROXY_PORT% >>freenet.ini
+
+:: Try to detect a free, aviable port for fcp
+ at set FCP_PORT=9481
+ at java -jar bin\bindtest.java %FCP_PORT%
+ at if not errorlevel 0 set FCP_PORT=9482
+ at echo fcp.enable=true >>freenet.ini
+ at echo fcp.port=%FCP_PORT% >>freenet.ini
+
+:: Try to detect a free, aviable port for console
+ at set CONSOLE_PORT=2323
+ at java -jar bin\bindtest.java %CONSOLE_PORT%
+ at if not errorlevel 0 set CONSOLE_PORT=2324
+ at echo console.enable=true >>freenet.ini
+ at echo console.port=%CONSOLE_PORT% >>freenet.ini
+
@echo "Downloading freenet-stable-latest.jar"
@java -jar bin\sha1test.jar freenet-stable-latest.jar "$INSTALL_PATH"
@echo "Downloading freenet-ext.jar"
@@ -13,10 +37,13 @@
@echo "Installing the wrapper"
@echo "Registering Freenet as a system service"
@bin\wrapper-windows-x86-32.exe -i ../wrapper.conf
+
+:: Start the node up
@net start freenet-darknet
@echo "Waiting for freenet to startup"
@ping -n 5 127.0.0.1 >nul
+
@echo "Spawing up a browser"
- at start http://127.0.0.1:8888
+ at start http://127.0.0.1:%FPROXY_PORT%/
@start file:///$INSTALL_PATH/welcome.html
@echo "Finished"