Author: nextgens
Date: 2006-03-31 12:54:26 +0000 (Fri, 31 Mar 2006)
New Revision: 8387

Added:
   trunk/apps/installer/src/BareBonesBrowserLaunch.java
Modified:
   trunk/apps/installer/build-installer.xml
   trunk/apps/installer/build.xml
   trunk/apps/installer/installclasspath/linux/update.sh
   trunk/apps/installer/installclasspath/run.cmd
   trunk/apps/installer/installclasspath/run.sh
Log:
installer: New improved version, still lacking windows update script (thanks to 
kork for correcting my spelling mistakes)

Modified: trunk/apps/installer/build-installer.xml
===================================================================
--- trunk/apps/installer/build-installer.xml    2006-03-31 12:23:35 UTC (rev 
8386)
+++ trunk/apps/installer/build-installer.xml    2006-03-31 12:54:26 UTC (rev 
8387)
@@ -14,7 +14,7 @@
                classname="org.tp23.antinstaller.taskdefs.Installer"
                classpathref="taskdef.cp"/>

-       <target name="selfextract" depends="compile_sha1test">
+       <target name="selfextract" depends="compile_sha1test,compile_browser">
                <echo message="Building INSTALLER SELFEXTRACT"/>
                <installer file="./selfextractpack.jar" compress="true"
                                extractType="SelfExtractor"
@@ -41,4 +41,16 @@
            </javac>
            <jar jarfile="./installclasspath/sha1test.jar" basedir="./build"/>
          </target>
+
+        <target name="compile_browser">
+           <!-- Create the time stamp -->
+           <tstamp/>
+           <!-- Create the build directory structure used by compile -->
+
+           <mkdir dir="build"/>
+           <javac srcdir="./src" destdir="./build" optimize="on" source="1.4">
+             <include name="BareBonesBrowserLaunch.java"/>
+           </javac>
+           <jar jarfile="./installclasspath/browser.jar" basedir="./build"/>
+         </target>
 </project>

Modified: trunk/apps/installer/build.xml
===================================================================
--- trunk/apps/installer/build.xml      2006-03-31 12:23:35 UTC (rev 8386)
+++ trunk/apps/installer/build.xml      2006-03-31 12:54:26 UTC (rev 8387)
@@ -108,13 +108,13 @@
                </replace>
        </target>

-       <target name="default" 
depends="pre,config_default,tgmain,tgext,darknet,testnet,windows,unix,frost">
+       <target name="default" 
depends="pre,config_default,tgmain,tgext,darknet,testnet,windows,unix,frost,start_browser">
                <mkdir dir="${installDir}/lib"/>
                <mkdir dir="${installDir}/bin"/>
                <copy todir="${installDir}/bin/">
                        <fileset dir="${basedir}/bin/"/>
                </copy>
-               <chmod file="${installDir}/bin/wrapper" perm="775"/>
+               <chmod file="${installDir}/bin/wrapper" perm="755"/>
                <copy todir="${installDir}/lib/">
                        <fileset dir="${basedir}/lib/"/>
                </copy>
@@ -157,23 +157,29 @@
                        <arg value="/c"/>
                        <arg value="run.cmd"/>
                </exec>
+               
+               <echo message="Starting the node up"/>
+               <sleep seconds="10"/>
+               <java classpath="${basedir}/browser.jar" 
classname="BareBonesBrowserLaunch" failonerror="false" fork="true" 
logError="true">
+                       <arg value="http://localhost:${fproxyport}/"/>
+               </java>
        </target>

        <target name="unix" if="is_unix">
                <copy file="${basedir}/run.sh"  tofile="${installDir}/run.sh"/>
-               <chmod file="${installDir}/run.sh" perm="775"/>
+               <chmod file="${installDir}/run.sh" perm="755"/>
                <replace file="${installDir}/run.sh">
                        <replacefilter token="@fproxyport@" 
value="${fproxyport}"/>
                </replace>

                <copy file="${basedir}/linux/update.sh"  
tofile="${installDir}/update.sh"/>
-               <chmod file="${installDir}/update.sh" perm="775"/>
+               <chmod file="${installDir}/update.sh" perm="755"/>
                <replace file="${installDir}/update.sh">
                        <replacefilter token="@path@" value="/${basedir}/"/>
                </replace>

                <echo message="Creating shortcuts"/>
-               <chmod file="${basedir}/linux/CreateDesktopShortcut.sh" 
perm="775"/>
+               <chmod file="${basedir}/linux/CreateDesktopShortcut.sh" 
perm="755"/>
                <exec executable="sh" dir="${basedir}/linux/">
                        <arg value="CreateDesktopShortcut.sh"/>
                        <arg value="${freenetWorkingMode}"/>
@@ -186,7 +192,20 @@
                        <arg value="run.sh"/>
                        <arg value="start"/>
                </exec>
+
+               
+               <echo message="Starting the node up"/>
+               <sleep seconds="10"/>
+               <java classpath="${basedir}/browser.jar" 
classname="BareBonesBrowserLaunch" failonerror="false" fork="true" 
logError="true">
+                       <arg value="http://localhost:${fproxyport}/"/>
+               </java>
        </target>
+
+       <target name="start_browser">
+               <java classpath="${basedir}/browser.jar" 
classname="BareBonesBrowserLaunch" failonerror="false" fork="true" 
logError="true">
+                       <arg 
value="http://wiki.freenetproject.org/InstallCompleted"/>
+               </java>
+       </target>

        <target name="frost" unless="skip_frost">
                <echo message="Downloading Frost"/>

Modified: trunk/apps/installer/installclasspath/linux/update.sh
===================================================================
--- trunk/apps/installer/installclasspath/linux/update.sh       2006-03-31 
12:23:35 UTC (rev 8386)
+++ trunk/apps/installer/installclasspath/linux/update.sh       2006-03-31 
12:54:26 UTC (rev 8387)
@@ -14,7 +14,9 @@
        mv freenet-cvs-snapshot.jar.url freenet-cvs-snapshot.jar.url.old

        echo "Restarting freenet"
-       ./run.sh restart
+       exec sh run.sh restart
+else
+       echo "Your freenet node is up to date"
 fi

 popd 2>&1 >/dev/null

Modified: trunk/apps/installer/installclasspath/run.cmd
===================================================================
--- trunk/apps/installer/installclasspath/run.cmd       2006-03-31 12:23:35 UTC 
(rev 8386)
+++ trunk/apps/installer/installclasspath/run.cmd       2006-03-31 12:54:26 UTC 
(rev 8387)
@@ -4,5 +4,3 @@
 @echo "Registering Freenet as a system service"
 @bin\wrapper -i ../wrapper.conf
 @net start @serviceName@
- at ping 127.0.0.1 -n 10 > NUL
-start http://localhost:@fproxyport@/

Modified: trunk/apps/installer/installclasspath/run.sh
===================================================================
--- trunk/apps/installer/installclasspath/run.sh        2006-03-31 12:23:35 UTC 
(rev 8386)
+++ trunk/apps/installer/installclasspath/run.sh        2006-03-31 12:54:26 UTC 
(rev 8387)
@@ -15,8 +15,8 @@
 APP_LONG_NAME="Freenet 0.7"

 # Wrapper
-WRAPPER_CMD="./bin/wrapper"
-WRAPPER_CONF="./wrapper.conf"
+WRAPPER_CMD="bin/wrapper"
+WRAPPER_CONF="wrapper.conf"

 # Priority at which to run the wrapper.  See "man nice" for valid priorities.
 #  nice is only used if a priority is specified.

Added: trunk/apps/installer/src/BareBonesBrowserLaunch.java
===================================================================
--- trunk/apps/installer/src/BareBonesBrowserLaunch.java        2006-03-31 
12:23:35 UTC (rev 8386)
+++ trunk/apps/installer/src/BareBonesBrowserLaunch.java        2006-03-31 
12:54:26 UTC (rev 8387)
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////////// // Bare Bones 
Browser Launch // // Version 1.5 // // December 10, 2005 // // Supports: Mac OS 
X, GNU/Linux, Unix, Windows XP // // Example Usage: // // String url = 
"http://www.centerkey.com/";;
+// // BareBonesBrowserLaunch.openURL(url);
+// // Public Domain Software -- Free to Use as You Like // 
/////////////////////////////////////////////////////////
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import javax.swing.JOptionPane;
+public class BareBonesBrowserLaunch {
+       private static final String errMsg = "Error attempting to launch web 
browser";
+       public static void main(String arg[]) {
+               String url = arg[0];
+               String osName = System.getProperty("os.name");
+               try {
+                       if (osName.startsWith("Mac OS")) {
+                               Class fileMgr = 
Class.forName("com.apple.eio.FileManager");
+                               Method openURL = 
fileMgr.getDeclaredMethod("openURL", new Class[] {
+                                       String.class
+                               }
+                               );
+                               openURL.invoke(null, new Object[] {
+                                       url}
+                                       );
+                       }
+                       else if (osName.startsWith("Windows")) 
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
+                       else {
+                               //assume Unix or Linux
+                               String[] browsers = {"firefox", "opera", 
"konqueror", "epiphany", "mozilla", "netscape" }
+                               ;
+                               String browser = null;
+                               for (int count = 0;
+                                               count < browsers.length && 
browser == null;
+                                               count++) if 
(Runtime.getRuntime().exec( new String[] {
+                                       "which", browsers[count]}
+                                       ).waitFor() == 0) browser = 
browsers[count];
+                                               if (browser == null) throw new 
Exception("Could not find web browser");
+                                               else 
Runtime.getRuntime().exec(new String[] {
+                                                       browser, url}
+                                                       );
+                       }
+               }
+               catch (Exception e) {
+                       JOptionPane.showMessageDialog(null, errMsg + ":\n" + 
e.getLocalizedMessage());
+               }
+       }
+}
+


Reply via email to