[Swift-commit] r7998 - trunk/etc

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Jul 12 01:27:50 CDT 2014


Author: hategan
Date: 2014-07-12 01:27:49 -0500 (Sat, 12 Jul 2014)
New Revision: 7998

Added:
   trunk/etc/launcher-template
   trunk/etc/launcher-template.bat
Log:
added swift launcher templates

Added: trunk/etc/launcher-template
===================================================================
--- trunk/etc/launcher-template	                        (rev 0)
+++ trunk/etc/launcher-template	2014-07-12 06:27:49 UTC (rev 7998)
@@ -0,0 +1,102 @@
+#! /bin/sh 
+
+EXEC=@class@
+OPTIONS=
+
+CYGWIN=
+CPDELIM=":"
+HEAPMAX=
+
+ at umask@
+
+if echo `uname` | grep -i "cygwin"; then
+    CYGWIN="yes"
+    CPDELIM=";"
+fi
+
+fixCommandLine() {
+
+    COMMANDLINE=
+
+    while [ "X$1" !=  "X" ] ; do
+        COMMANDLINE="${COMMANDLINE} '$1'"
+        shift
+    done
+
+    echo $COMMANDLINE
+}
+
+updateOptions() {
+ 
+    if [ "X$1" != "X" ] ; then
+	OPTIONS="$OPTIONS -D$2=$1"
+    fi
+
+}
+
+####### MAIN BODY ##########
+
+if [ ! -d "$SWIFT_HOME" ] ; then
+    SWIFT_HOME=$(cd $(dirname $0)/..; pwd)
+    if [ ! -f "$SWIFT_HOME/lib/@jar@" ] && [ ! -f "$SWIFT_HOME/lib/cog.jar" ] ; then
+		MY_PATH=`which $0`
+		SWIFT_HOME=`dirname $MY_PATH`"/.."
+		if [ ! -f "$SWIFT_HOME/lib/@jar@" ] && [ ! -f "$SWIFT_HOME/lib/cog.jar" ] ; then
+	    	echo "Error: SWIFT_HOME is not set, and all attempts at guessing it failed"
+	    	exit 1
+		fi
+    fi
+fi
+
+OPTIONS="$OPTIONS -Djava.endorsed.dirs=$COG_INSTALL_PATH/lib/endorsed"
+
+LOCALCLASSPATH=$SWIFT_HOME/etc$CPDELIM$SWIFT_HOME/libexec
+for JAR in $SWIFT_HOME/lib/*.jar; do
+	LOCALCLASSPATH="$LOCALCLASSPATH$CPDELIM$JAR"
+done
+
+LOCALCLASSPATH=$LOCALCLASSPATH$CPDELIM$CLASSPATH
+
+CMDLINE=`fixCommandLine "$@"`
+
+### SETUP OTHER ENV VARIABLES ####
+
+USERID=`id | awk '{printf("%s\n", substr($1, 5, index($1, "(")-5 ) ) }'`
+
+if [ "X$GLOBUS_HOSTNAME" = "X" ] && [ "X$HOSTNAME" != "X" ]; then 
+	GLOBUS_HOSTNAME=$HOSTNAME  
+fi
+
+updateOptions "$USERID" "UID"
+updateOptions "$GLOBUS_INSTALL_PATH" "GLOBUS_INSTALL_PATH"
+updateOptions "$GLOBUS_DEPLOY_PATH" "GLOBUS_DEPLOY_PATH"
+updateOptions "$GLOBUS_TCP_PORT_RANGE" "GLOBUS_TCP_PORT_RANGE"
+updateOptions "$GLOBUS_TCP_SOURCE_PORT_RANGE" "GLOBUS_TCP_SOURCE_PORT_RANGE"
+updateOptions "$GLOBUS_UDP_SOURCE_PORT_RANGE" "GLOBUS_UDP_SOURCE_PORT_RANGE"
+updateOptions "$GLOBUS_HOSTNAME" "GLOBUS_HOSTNAME"
+updateOptions "$X509_USER_CERT" "X509_USER_CERT"
+updateOptions "$X509_USER_KEY" "X509_USER_KEY"
+updateOptions "$X509_CERT_DIR" "X509_CERT_DIR"
+updateOptions "$X509_USER_PROXY" "X509_USER_PROXY"
+updateOptions "$SWIFT_HOME" "COG_INSTALL_PATH"
+updateOptions "$SWIFT_HOME" "swift.home"
+updateOptions "$SWIFT_USERHOME" "user.home"
+
+if [ "X$HEAPMAX" != "X" ]; then
+	OPTIONS="-Xmx$HEAPMAX $OPTIONS"
+fi
+
+### EXECUTE ############
+if test -n "$CYGWIN"; then
+    set CLASSPATHSAVE=$CLASSPATH
+    export CLASSPATH="$LOCALCLASSPATH"
+    eval java ${OPTIONS} ${COG_OPTS} ${EXEC} ${CMDLINE}
+    export CLASSPATH=$CLASSPATHSAVE
+else
+    eval java ${OPTIONS} ${COG_OPTS} -classpath ${LOCALCLASSPATH} ${EXEC} ${CMDLINE}
+fi
+return_code=$?
+
+exit $return_code
+
+


Property changes on: trunk/etc/launcher-template
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/etc/launcher-template.bat
===================================================================
--- trunk/etc/launcher-template.bat	                        (rev 0)
+++ trunk/etc/launcher-template.bat	2014-07-12 06:27:49 UTC (rev 7998)
@@ -0,0 +1,78 @@
+ at echo off
+
+if "X%SWIFT_HOME%" == "X" goto nocogpath
+goto cogpath
+
+:nocogpath
+    set UNSET_SWIFT_HOME=1
+    set SWIFT_HOME=..
+    if NOT EXIST "%SWIFT_HOME%\lib\@jar@" goto nocogpath15
+    goto cogpath
+	
+:nocogpath15
+	if NOT EXIST "%SWIFT_HOME%\lib\cog.jar" goto nocogpath2
+	goto cogpath
+
+:nocogpath2
+    rem test for expansion extensions first, so that we don't enter an infinite loop
+    set PARTIAL_PATH=test
+    set PARTIAL_PATH=%PARTIAL_PATH:~-2%
+    if NOT "%PARTIAL_PATH%" == "st" goto nocogpath3
+    set PARTIAL_PATH=%~f0
+    set FIRST_BACKSLASH=1
+    
+:loop
+    set LAST_CHAR=%PARTIAL_PATH:~-1%
+    set PARTIAL_PATH=%PARTIAL_PATH:~0,-1%
+    if "%LAST_CHAR%" == "\" goto found
+    if "X%PARTIAL_PATH%" == "X" goto nocogpath3
+    goto loop
+
+    
+:found
+    if "%FIRST_BACKSLASH%" == "0" goto found2
+    set FIRST_BACKSLASH=0
+    goto loop
+
+:found2
+    set SWIFT_HOME=%PARTIAL_PATH%
+    if NOT EXIST "%SWIFT_HOME%\lib\@jar@" goto nocogpath25
+    goto cogpath
+	
+:nocogpath25
+	if NOT EXIST "%SWIFT_HOME%\lib\cog.jar" goto nocogpath3
+	goto cogpath
+    
+:nocogpath3
+    echo Error: SWIFT_HOME not set and all attempts at guessing it failed
+    goto end
+
+:cogpath
+
+	set OPTS=-DCOG_INSTALL_PATH="%SWIFT_HOME%" -Dswift.home="%SWIFT_HOME%"%COG_OPTS% -Djava.endorsed.dirs="%SWIFT_HOME%\lib\endorsed"
+
+	set LOCALCLASSPATH=%CLASSPATH%;%SWIFT_HOME%\etc;%SWIFT_HOME%\libexec
+	
+	for %%J in ("%SWIFT_HOME%\lib\*.jar") DO call :setpath %%J
+    
+    set SAVECLASSPATH=%CLASSPATH%
+    set CLASSPATH=%LOCALCLASSPATH%
+    java %OPTS% @class@ %*
+    set CLASSPATH=%SAVECLASSPATH%
+
+:end
+    if "%UNSET_SWIFT_HOME%"=="1" goto restore
+    goto done
+    
+:setpath
+    set LOCALCLASSPATH=%LOCALCLASSPATH%;%*
+    goto done
+
+:restore
+    set SWIFT_HOME=
+    set PARTIAL_PATH=
+    set LAST_CHAR=
+    set UNSET_SWIFT_HOME=
+    set FIRST_BAKSLASH=
+
+:done




More information about the Swift-commit mailing list