Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhmalphettes2011-12-21 00:08:39 +0000
committerhmalphettes2011-12-21 00:08:39 +0000
commit84773a14e634beced1326d65b3d0d66c72ecbf98 (patch)
treeb71006fb55adb12f9f1d21ad14efaed993503899
parente7d0d6c4c8c10b57cef032d31f98f085bb445485 (diff)
downloadorg.eclipse.jetty.releng.products-84773a14e634beced1326d65b3d0d66c72ecbf98.tar.gz
org.eclipse.jetty.releng.products-84773a14e634beced1326d65b3d0d66c72ecbf98.tar.xz
org.eclipse.jetty.releng.products-84773a14e634beced1326d65b3d0d66c72ecbf98.zip
Fixes for macosx. Support for passing java system properties on the command line.
-rwxr-xr-xjetty-features/org.eclipse.jetty.product/jettyhome/start.sh40
1 files changed, 35 insertions, 5 deletions
diff --git a/jetty-features/org.eclipse.jetty.product/jettyhome/start.sh b/jetty-features/org.eclipse.jetty.product/jettyhome/start.sh
index 21e7716..86df85b 100755
--- a/jetty-features/org.eclipse.jetty.product/jettyhome/start.sh
+++ b/jetty-features/org.eclipse.jetty.product/jettyhome/start.sh
@@ -37,7 +37,7 @@ if [ -f "$ini" ]; then
#read the startup
startup=`sed -n '/^-startup/{n;p;}' $ini`
#consume the -startup line and its value which is the next line.
- args=`sed '/^-startup/,+1d' $ini`
+ args=$(echo "$args" | sed -n '/^-startup/{n;d;}' | sed '/^-startup/d')
#remove the -vmargs and following lines.
args=`echo "$args" | sed -n '/^-vmargs/,$!p'`
fi
@@ -62,7 +62,7 @@ XXMaxPermSize=`echo "$args" | sed -n '/--launcher\.XXMaxPermSize/{n;p;}'`
if [ -n "$XXMaxPermSize" ]; then
XXMaxPermSize="-XX:MaxPermSize=$XXMaxPermSize"
#also remove those 2 lines from the args
- args=`echo "$args" | sed '/--launcher\.XXMaxPermSize/,+1d'`
+ args=$(echo "$args" | sed -n '/--launcher\.XXMaxPermSize/{n;d;}' | sed '/--launcher\.XXMaxPermSize/d')
fi
#vmargs
#VMARGS=`sed '1,/-vmargs/d' $ini | tr '\n' ' '`$XXMaxPermSize
@@ -124,12 +124,14 @@ fi
#use -install unless it was already specified in the ini file:
installArg=$(echo "$args" | sed '/^-install/!d')
-if [ -n "$installArg" ]; then
+if [ -n "$installArg" -a -e "$installArg" ]; then
#installArg=`echo "$args" | sed -n '/-install/{n;p;}'`
#leave the install as defined
installArg=""
else
installArg=" -install $eclipsehome"
+ # remove the -install and following line so that we don't get 2 -install parameters
+ args=$(echo "$args" | sed -n '/^-install/{n;d;}' | sed '/^-install/d')
fi
#use -configuration unless it was already specified in the ini file:
@@ -142,6 +144,34 @@ else
configurationArg=" -configuration $tmp_config_area"
fi
+#Save the original config.ini file before we apply to it the sys properties found
+#on the cmd line.
+if [ -f configuration/config.ini.ori ]; then
+ cp configuration/config.ini.ori configuration/config.ini
+else
+ cp configuration/config.ini configuration/config.ini.ori
+fi
+#Read the cmd args and if they are java sys properties
+#write them in the config.ini file.
+for tok in $*; do
+ sysprop=$(echo $tok | sed '/^-D.*=/!d')
+ if [ -n "$sysprop" ]; then
+ name=$(echo $tok | sed 's/^-D\(.*\)=\(.*\)/\1/g')
+ name_escaped=$(echo $name | sed 's/\./\\./g')
+ value=$(echo $tok | sed 's/^-D.*=\(.*\)$/\1/g')
+ value_prop=$(echo $value | sed 's/:/\\\\:/g')
+ already=$(sed "/$name_escaped/!d" configuration/config.ini)
+ #echo "name $name value $value value_prop $value_prop already $already"
+ if [ -n "$already" ]; then
+ sed -i -e "s/^$name_escaped=.*$/$name=$value_prop/g" configuration/config.ini
+ else
+ echo "$name=$value_prop" >> configuration/config.ini
+ fi
+ else
+ new_cmd_params="$new_cmd_params $tok"
+ fi
+done
+
#Read the console argument. It could be a flag.
#console=`awk '{if ($1 ~ /-console/){print $1}}' < $ini | head -1`
console=`echo "$args" | sed '/^-console/!d'`
@@ -158,6 +188,6 @@ fi
args=`echo "$args" | tr '\n' ' '`
-cmd="java $JAVA_OPTS -jar $startup $args$installArg$configurationArg$console $*"
+cmd="java $JAVA_OPTS -jar $startup $args$installArg$configurationArg$console$new_cmd_params"
echo "Staring Equinox with $cmd"
-$cmd \ No newline at end of file
+#$cmd

Back to the top