Skip to content
Browse files

Fixed and fully tested mac install from path containing spaces

  • Loading branch information...
1 parent 63c41ea commit 501ebba4fabc49e84f2dac684eaf582ccf73e13f @BrianGilbert BrianGilbert committed Oct 14, 2015
Showing with 26 additions and 25 deletions.
  1. +26 −25 mac_install
View
51 mac_install
@@ -16,8 +16,8 @@
# Logs the command to be run and then executes the command while logging the results.
RunAndLog () {
- echo `date` Executing $@>>"$LOGFILE"
- $@ 1>>"$LOGFILE" 2>"$ERRORFILE"
+ echo `date` Executing "$@">>"$LOGFILE"
+ "$@" 1>>"$LOGFILE" 2>"$ERRORFILE"
if [ "$?" != "0" ] ; then
cat "$ERRORFILE" >>"$LOGFILE"
echo `date` Failure forced early exit>>"$LOGFILE"
@@ -35,18 +35,18 @@ ROOTDIR=$0
ROOTDIR=${ROOTDIR%/*}
pushd $ROOTDIR
ROOTDIR=$PWD
-LOGFILE=$ROOTDIR/mac_install.log
-ERRORFILE=$ROOTDIR/mac_install.err
+LOGFILE="$ROOTDIR"/mac_install.log
+ERRORFILE="$ROOTDIR"/mac_install.err
GCC4ARM_VERSION=gcc-arm-none-eabi-4_8-2014q1
GCC4ARM_FILENAME=gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2
GCC4ARM_URL=https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/$GCC4ARM_FILENAME
-GCC4ARM_TAR=$ROOTDIR/$GCC4ARM_FILENAME
+GCC4ARM_TAR="$ROOTDIR"/$GCC4ARM_FILENAME
GCC4ARM_MD5=5d34d95a53ba545f1585b9136cbb6805
-GCC4ARM_EXTRACT=$ROOTDIR/$GCC4ARM_VERSION
-GCC4ARM_DIR=$ROOTDIR/gcc-arm-none-eabi
+GCC4ARM_EXTRACT="$ROOTDIR"/$GCC4ARM_VERSION
+GCC4ARM_DIR="$ROOTDIR"/gcc-arm-none-eabi
GCC4ARM_BINDIR=$GCC4ARM_DIR/bin
-MACBIN_DIR=$ROOTDIR/build/osx64
-BUILDSHELL_CMD=$ROOTDIR/BuildShell
+MACBIN_DIR="$ROOTDIR"/build/osx64
+BUILDSHELL_CMD="$ROOTDIR"/BuildShell
echo Logging install results to "$LOGFILE"
@@ -70,28 +70,29 @@ if [ "$archive_match" != "1" ] ; then
fi
echo Extracting GNU Tools for ARM Embedded Processors...
-rm -r $GCC4ARM_DIR >/dev/null 2>/dev/null
-RunAndLog tar xf $GCC4ARM_TAR
-RunAndLog mv $GCC4ARM_EXTRACT $GCC4ARM_DIR
+rm -r "$GCC4ARM_DIR" >/dev/null 2>/dev/null
+echo $GCC4ARM_TAR
+RunAndLog tar xf "$GCC4ARM_TAR"
+RunAndLog mv "$GCC4ARM_EXTRACT" "$GCC4ARM_DIR"
echo Installing patched 64-bit Intel Mac OS X GDB binaries...
-RunAndLog cp $MACBIN_DIR/arm-none-eabi-gdb* $GCC4ARM_BINDIR/
+RunAndLog cp "$MACBIN_DIR"/arm-none-eabi-gdb* "$GCC4ARM_BINDIR/"
echo Creating helper scripts...
-echo "#! /usr/bin/env bash">$BUILDSHELL_CMD
-echo "# Modify next line and set destination drive to match mbed device">>$BUILDSHELL_CMD
-echo "export LPC_DEPLOY='cp PROJECT.bin /Volumes/MBED/ ; sync'">>$BUILDSHELL_CMD
-echo>>$BUILDSHELL_CMD
-echo "SCRIPT_PATH=\$0">>$BUILDSHELL_CMD
-echo "SCRIPT_PATH=\${SCRIPT_PATH%/*}">>$BUILDSHELL_CMD
-echo "cd \$SCRIPT_PATH">>$BUILDSHELL_CMD
-echo "SCRIPT_PATH=\$PWD">>$BUILDSHELL_CMD
-echo "export PATH=\$SCRIPT_PATH/gcc-arm-none-eabi/bin:\$SCRIPT_PATH/build/osx64:\$PATH">>$BUILDSHELL_CMD
-echo "exec bash">>$BUILDSHELL_CMD
-chmod +x $BUILDSHELL_CMD
+echo "#! /usr/bin/env bash">"$BUILDSHELL_CMD"
+echo "# Modify next line and set destination drive to match mbed device">>"$BUILDSHELL_CMD"
+echo "export LPC_DEPLOY='cp PROJECT.bin /Volumes/MBED/ ; sync'">>"$BUILDSHELL_CMD"
+echo>>"$BUILDSHELL_CMD"
+echo "SCRIPT_PATH=\$0">>"$BUILDSHELL_CMD"
+echo "SCRIPT_PATH=\${SCRIPT_PATH%/*}">>"$BUILDSHELL_CMD"
+echo "cd \$SCRIPT_PATH">>"$BUILDSHELL_CMD"
+echo "SCRIPT_PATH=\$PWD">>"$BUILDSHELL_CMD"
+echo "export PATH=\$SCRIPT_PATH/gcc-arm-none-eabi/bin:\$SCRIPT_PATH/build/osx64:\$PATH">>"$BUILDSHELL_CMD"
+echo "exec bash">>"$BUILDSHELL_CMD"
+chmod +x "$BUILDSHELL_CMD"
echo Cleaning up intermediate files...
-RunAndLog rm $GCC4ARM_TAR
+RunAndLog rm "$GCC4ARM_TAR"
echo
echo To build Smoothie, you will first need to run the following script

0 comments on commit 501ebba

Please sign in to comment.
Something went wrong with that request. Please try again.