# HG changeset patch # User Tim Smith hg@tds.xyz # Date 1486624426 28800 # Wed Feb 08 23:13:46 2017 -0800 # Node ID 8493808da8a1ea40baa5bbf79ea1c33e5646c935 # Parent 0b276128fdd8d7b02aee5d41216d37f11632af0b Fix app launching on OS X #4479
Running chirp .app bundles from ~/Downloads was observed to fail on recent versions of OS X. This is because a OS X security feature called App Translocation is actually executing the .app bundle from a temporary read-only disk image, and the chirp launch script attempts to modify the contents of the app bundle.
This patch avoids modifying the .app bundle when App Translocation is active.
diff -r 0b276128fdd8 -r 8493808da8a1 build/chirp.app/Contents/MacOS/chirp --- a/build/chirp.app/Contents/MacOS/chirp Mon Feb 06 12:09:45 2017 -0800 +++ b/build/chirp.app/Contents/MacOS/chirp Wed Feb 08 23:13:46 2017 -0800 @@ -2,14 +2,18 @@
LOCATION=$(dirname "${BASH_SOURCE}")
-PYTHON=/opt/kk7ds//Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python +PYTHON=/opt/kk7ds/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
-if [ -x $PYTHON ]; then +not_translocated () { + security translocate-status-check "${LOCATION}" 2>&1 | grep -q -e NOT -e unknown -e "not found" +} + +if [ ! -x $PYTHON ]; then + PYTHON=/opt/kk7ds/bin/python2.7 +elif not_translocated; then ln -s $PYTHON "${LOCATION}/../CHIRP" PYTHON=${LOCATION}/../CHIRP - export PYTHONPATH="/opt/kk7ds//Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/" -else - PYTHON=/opt/kk7ds/bin/python2.7 + export PYTHONPATH=/opt/kk7ds/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages fi
exec "$PYTHON" "${LOCATION}/../Resources/chirp/chirpw"