Fixes for macosx. Support for passing java system properties on the command line.
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 @@
   #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 @@
 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 @@
 
 #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 @@
     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 @@
 
 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