You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ch...@apache.org on 2007/12/12 04:05:50 UTC

svn commit: r603445 - in /servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main: java/org/apache/servicemix/runtime/gshell/wrapper/ resources/org/apache/servicemix/runtime/gshell/wrapper/unix/ resources/org/apache/servicemix/runtime/gshell/wrapp...

Author: chirino
Date: Tue Dec 11 19:05:47 2007
New Revision: 603445

URL: http://svn.apache.org/viewvc?rev=603445&view=rev
Log:
Made the executeable names be based on the name specified

Modified:
    servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/java/org/apache/servicemix/runtime/gshell/wrapper/InstallCommand.java
    servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/unix/servicemix-service
    servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/windows/servicemix-service.bat

Modified: servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/java/org/apache/servicemix/runtime/gshell/wrapper/InstallCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/java/org/apache/servicemix/runtime/gshell/wrapper/InstallCommand.java?rev=603445&r1=603444&r2=603445&view=diff
==============================================================================
--- servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/java/org/apache/servicemix/runtime/gshell/wrapper/InstallCommand.java (original)
+++ servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/java/org/apache/servicemix/runtime/gshell/wrapper/InstallCommand.java Tue Dec 11 19:05:47 2007
@@ -70,28 +70,28 @@
 			File serviceFile=null;
 			if( os.startsWith("Win") ) {
 				mkdir(bin);
-				copyResourceToDir(bin, "windows/servicemix-wrapper.exe", false);
-				serviceFile = new File(bin,"servicemix-service.bat");
+				copyResourceTo(new File(bin, name+"-wrapper.exe"), "windows/servicemix-wrapper.exe", false);
+				serviceFile = new File(bin,name+"-service.bat");
 				copyFilteredResourceTo(serviceFile, "windows/servicemix-service.bat", props);
 				mkdir(lib);
-				copyResourceToDir(lib, "windows/wrapper.dll", false);								
+				copyResourceTo(new File(bin, "wrapper.dll"), "windows/wrapper.dll", false);								
 			} else if( os.startsWith("Mac OS X") ) {
 				mkdir(bin);
-				copyResourceToDir(bin, "macosx/servicemix-wrapper", false);
-				serviceFile = new File(bin,"servicemix-service");
+				copyResourceTo(new File(bin, name+"-wrapper"), "macosx/servicemix-wrapper", false);
+				serviceFile = new File(bin,name+"-service");
 				copyFilteredResourceTo(serviceFile, "unix/servicemix-service", props);
 				mkdir(lib);
-				copyResourceToDir(lib, "macosx/libwrapper.jnilib", false);
+				copyResourceTo(new File(lib, "libwrapper.jnilib"), "macosx/libwrapper.jnilib", false);
 				
 				// TODO: figure out how to hook in the service that it starts up
 				// when the machine boots up.
 			} else if( os.startsWith("Linux") ) {
 				mkdir(bin);
-				copyResourceToDir(bin, "linux/servicemix-wrapper", false);
-				serviceFile = new File(bin,"servicemix-service");
+				copyResourceTo(new File(bin, name+"-wrapper"), "linux/servicemix-wrapper", false);
+				serviceFile = new File(bin,name+"-service");
 				copyFilteredResourceTo(serviceFile, "unix/servicemix-service", props);
 				mkdir(lib);
-				copyResourceToDir(lib, "linux/libwrapper.jnilib", false);
+				copyResourceTo(new File(lib, "libwrapper.so"), "linux/libwrapper.so", false);
 				
 				// TODO: figure out how to hook in the service that it starts up
 				// when the machine boots up.
@@ -102,11 +102,12 @@
 
     		// Install the wrapper jar to the lib directory..
 			mkdir(lib);
-			copyResourceToDir(lib, "all/servicemix-wrapper.jar", false);
+			copyResourceTo(new File(lib, "servicemix-wrapper.jar"), "all/servicemix-wrapper.jar", false);
 			mkdir(etc);
-			File wrapperConf = new File(etc,"servicemix-wrapper.conf");
+			File wrapperConf = new File(etc,name+"-wrapper.conf");
 			copyFilteredResourceTo(wrapperConf, "all/servicemix-wrapper.conf", props);
 
+			io.out.println("");
 			io.out.println("Setup complete.  You may want to tweak the JVM properties in the wrapper configuration file: "+wrapperConf.getPath());
 			io.out.println("before installing and starting the service.");
 			io.out.println("");
@@ -141,10 +142,9 @@
         return 0;
     }
 
-	private void copyResourceToDir(File target, String resource, boolean text) throws Exception {
-		File outFile = new File(target, new File(resource).getName());
+	private void copyResourceTo(File outFile, String resource, boolean text) throws Exception {
 		if( !outFile.exists() ) {
-	        io.out.println("Creating file: "+outFile.getPath()+"");
+	        io.out.println("Creating file: @|green "+outFile.getPath()+"|");
 			InputStream is = InstallCommand.class.getResourceAsStream(resource);
 			try {
 				if( text ) {
@@ -175,12 +175,14 @@
 			} finally {
 				safeClose(is);
 			}
+		} else {
+	        io.out.println("@|red File allready exists|. Move it out of the way if you want it re-created: "+outFile.getPath()+"");
 		}
 	}
 	
 	private void copyFilteredResourceTo(File outFile, String resource, HashMap<String, String> props) throws Exception {
 		if( !outFile.exists() ) {
-	        io.out.println("Creating file: "+outFile.getPath()+"");
+	        io.out.println("Creating file: @|green "+outFile.getPath()+"|");
 			InputStream is = InstallCommand.class.getResourceAsStream(resource);
 			try {
 				// Read it line at a time so that we can use the platform line ending when we write it out.
@@ -198,6 +200,8 @@
 			} finally {
 				safeClose(is);
 			}
+		} else {
+	        io.out.println("@|red File allready exists|. Move it out of the way if you want it re-created: "+outFile.getPath()+"");
 		}
 	}
 
@@ -233,7 +237,7 @@
 
 	private void mkdir(File file) {
 		if( !file.exists() ) {
-	        io.out.println("Creating dir:@|bold "+file.getPath()+"|");
+	        io.out.println("Creating missing directory: @|green "+file.getPath()+"|");
 			file.mkdirs();
 		}
 	}

Modified: servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/unix/servicemix-service
URL: http://svn.apache.org/viewvc/servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/unix/servicemix-service?rev=603445&r1=603444&r2=603445&view=diff
==============================================================================
--- servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/unix/servicemix-service (original)
+++ servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/unix/servicemix-service Tue Dec 11 19:05:47 2007
@@ -22,8 +22,8 @@
 APP_LONG_NAME="${displayName}"
 
 # Wrapper
-WRAPPER_CMD="${servicemix.base}/bin/servicemix-wrapper"
-WRAPPER_CONF="${servicemix.base}/etc/servicemix-wrapper.conf"
+WRAPPER_CMD="${servicemix.base}/bin/${APP_NAME}-wrapper"
+WRAPPER_CONF="${servicemix.base}/etc/${APP_NAME}-wrapper.conf"
 
 # Priority at which to run the wrapper.  See "man nice" for valid priorities.
 #  nice is only used if a priority is specified.
@@ -50,7 +50,7 @@
 # The following two lines are used by the chkconfig command. Change as is
 #  appropriate for your application.  They should remain commented.
 # chkconfig: 2345 20 80
-# description: @app.long.name@
+# description: ${displayName}
 
 # Do not modify anything beyond this point
 #-----------------------------------------------------------------------------

Modified: servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/windows/servicemix-service.bat
URL: http://svn.apache.org/viewvc/servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/windows/servicemix-service.bat?rev=603445&r1=603444&r2=603445&view=diff
==============================================================================
--- servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/windows/servicemix-service.bat (original)
+++ servicemix/smx4/runtime/trunk/gshell/gshell-wrapper/src/main/resources/org/apache/servicemix/runtime/gshell/wrapper/windows/servicemix-service.bat Tue Dec 11 19:05:47 2007
@@ -35,15 +35,15 @@
 goto end
 
 :doRun
-"%APP_BASE%\bin\servicemix-wrapper.exe" -c "%APP_BASE%\etc\servicemix-wrapper.conf"
+"%APP_BASE%\bin\%APP_NAME%-wrapper.exe" -c "%APP_BASE%\etc\%APP_NAME%-wrapper.conf"
 goto end
 
 :doInstall
-"%APP_BASE%\bin\servicemix-wrapper.exe" -i "%APP_BASE%\etc\servicemix-wrapper.conf"
+"%APP_BASE%\bin\%APP_NAME%-wrapper.exe" -i "%APP_BASE%\etc\%APP_NAME%-wrapper.conf"
 goto end
 
 :doRemove
-"%APP_BASE%\bin\servicemix-wrapper.exe" -r "%APP_BASE%\etc\servicemix-wrapper.conf"
+"%APP_BASE%\bin\%APP_NAME%-wrapper.exe" -r "%APP_BASE%\etc\%APP_NAME%-wrapper.conf"
 goto end
 
 :end