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.
This commit is contained in:
Tim Smith 2017-02-08 23:13:46 -08:00
parent 23e714b148
commit 9380b833e3

View file

@ -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"