diff --git a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh index a2499a6ce44..6f498d0d22e 100755 --- a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh +++ b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh @@ -10,6 +10,8 @@ # Red Hat Inc. - initial API and implementation ############################################################################### +SCRIPT_DIR=`dirname $0` + usage="\ Usage: $0 [ECLIPSE_OPTIONS] [-b BUILD_LOG] [TARGET_OPTION] @@ -69,29 +71,26 @@ while test $# -gt 0 ; do done # Make sure local directory exists and has contents initialized -if [ ! -d $HOME/cdtdebugger ]; then -mkdir -p $HOME/cdtdebugger -cp config.ini $HOME/cdtdebugger -cp dev.properties $HOME/cdtdebugger +if [ ! -d "$HOME/cdtdebugger" ]; then + /bin/sh "$SCRIPT_DIR/install.sh" || exit fi # Calculate platform-specific jar file names -olddir=`pwd` -cd ../.. -OSGI_JAR=`ls org.eclipse.osgi_*.jar` -SWT_JAR=`ls org.eclipse.swt.*.jar` +ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd) # install.sh will modify this line. DO NOT REMOVE THE FOLLOWING MARKER: @#@# +PLUGIN_DIR="$ECLIPSE_HOME/plugins" + +OSGI_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.osgi_*.jar' -printf "%f\n"` +SWT_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.swt.*.jar' -printf "%f\n"` SWT_PLUGIN=`echo $SWT_JAR | sed -e "s/_[0-9]*\..*.jar//"` -FS_JAR=`ls org.eclipse.core.filesystem.*.jar | grep -v java7` +FS_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.core.filesystem.*.jar' -printf "%f\n" | grep -v java7` FS_PLUGIN=`echo $FS_JAR | sed -e "s/_[0-9]*\..*.jar//"` -LINUX_JAR=`ls org.eclipse.cdt.core.linux.*.jar` +LINUX_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.cdt.core.linux.*.jar' -printf "%f\n"` LINUX_PLUGIN=`echo $LINUX_JAR | sed -e "s/_[0-9]*\..*.jar//"` -cd ..; ECLIPSE_HOME=`pwd` -cd $olddir # Run eclipse with the Stand-alone Debugger product specified -$ECLIPSE_HOME/eclipse -clean -product org.eclipse.cdt.debug.application.product \ --data $HOME/workspace-cdtdebug -configuration file\:$HOME/cdtdebugger \ --dev file\:$HOME/cdtdebugger/dev.properties $options \ --vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \ --Dlinux.plugin=$LINUX_PLUGIN -Declipse.home=$ECLIPSE_HOME +"$ECLIPSE_HOME/eclipse" -clean -product org.eclipse.cdt.debug.application.product \ + -data "$HOME/workspace-cdtdebug" -configuration file\:"$HOME/cdtdebugger" \ + -dev file\:"$HOME/cdtdebugger/dev.properties" $options \ + -vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \ + -Dlinux.plugin=$LINUX_PLUGIN -Declipse.home="$ECLIPSE_HOME" diff --git a/debug/org.eclipse.cdt.debug.application/scripts/install.sh b/debug/org.eclipse.cdt.debug.application/scripts/install.sh index fdb7016ebd4..13fa911c815 100755 --- a/debug/org.eclipse.cdt.debug.application/scripts/install.sh +++ b/debug/org.eclipse.cdt.debug.application/scripts/install.sh @@ -9,35 +9,35 @@ # Contributors: # Red Hat Inc. - initial API and implementation ############################################################################### -olddir=`pwd` -cd ../.. -PLUGINS_DIR=`pwd` + # Verify that the install script is being run from a plug-ins folder of a # downloaded Eclipse and not in a local user .eclipse folder. -if [ ! -f ../eclipse ]; then -echo "$0: error: eclipse executable not found in expected location" -echo " " -echo "This can occur if you are running this script from your local .eclipse directory" -echo "which would mean you are running a shared instance of the Eclipse platform for" -echo "your distro and have installed the Stand-alone Debugger from an eclipse.org" -echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro" -echo "version of Eclipse Debugger is not supported. If you are using a distro version" -echo "of the Eclipse platform, you should not use this script. Instead, install the" -echo "corresponding Eclipse CDT package for your distro (e.g. eclipse-cdt package)" -echo "which will install the Stand-alone Debugger for you." -exit 1 + +SCRIPT_DIR=`dirname $0` + +if [ ! -f "$SCRIPT_DIR/../../../eclipse" ]; then + echo "$0: error: eclipse executable not found in expected location" + echo " " + echo "This can occur if you are running this script from your local .eclipse directory" + echo "which would mean you are running a shared instance of the Eclipse platform for" + echo "your distro and have installed the Stand-alone Debugger from an eclipse.org" + echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro" + echo "version of Eclipse Debugger is not supported. If you are using a distro version" + echo "of the Eclipse platform, you should not use this script. Instead, install the" + echo "corresponding Eclipse CDT package for your distro (e.g. eclipse-cdt package)" + echo "which will install the Stand-alone Debugger for you." + exit 1 fi -cd $olddir -if [ ! -d $HOME/cdtdebugger ]; then -mkdir -p $HOME/cdtdebugger + +if [ ! -d "$HOME/cdtdebugger" ]; then + mkdir -p "$HOME/cdtdebugger" fi -cp config.ini $HOME/cdtdebugger -cp dev.properties $HOME/cdtdebugger -cp cdtdebug.sh $HOME/cdtdebugger -chmod +x $HOME/cdtdebugger/cdtdebug.sh -olddir=`pwd` -cd ../.. -PLUGINS_DIR=`pwd` -cd $olddir -sed -i -e "s,cd ../..,cd $PLUGINS_DIR," $HOME/cdtdebugger/cdtdebug.sh +cp "$SCRIPT_DIR/config.ini" "$HOME/cdtdebugger" +cp "$SCRIPT_DIR/dev.properties" "$HOME/cdtdebugger" +cp "$SCRIPT_DIR/cdtdebug.sh" "$HOME/cdtdebugger" +chmod +x "$HOME/cdtdebugger/cdtdebug.sh" + +ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd) +# Replace the entire line with tag @#@# by the actual location of the eclipse installation +sed -i -e "s,^.*@#@#.*$,ECLIPSE_HOME=$ECLIPSE_HOME," "$HOME/cdtdebugger/cdtdebug.sh" echo "Installation complete"