Fix detection of file type.
authorGuy Harris <guy@alum.mit.edu>
Wed, 21 Feb 2018 18:08:49 +0000 (10:08 -0800)
committerGuy Harris <guy@alum.mit.edu>
Wed, 21 Feb 2018 18:09:30 +0000 (18:09 +0000)
Some versions of otool print the file name as the first line when you
run it with -hv, so that the line containing the file type is the fourth
line; others don't print it, so that it's the third line.  Instead, look
for the line that has MH_MAGIC.

Change-Id: Ib14f6b24f14069532263332e53a1e9895663641a
Reviewed-on: https://code.wireshark.org/review/25968
Reviewed-by: Guy Harris <guy@alum.mit.edu>
packaging/macosx/osx-app.sh.in

index c6361e3b2a8c8aa69f469d982694d769fd7747ef..8bf91782e7647c866cf09a9890466602a4e19b27 100755 (executable)
@@ -317,7 +317,7 @@ rpathify_file () {
        #
        # OK, what type of file is this?
        #
-       filetype=$( otool -hv "$1" | sed -n '4p' | awk '{print $5}' ; exit ${PIPESTATUS[0]} )
+       filetype=$( otool -hv "$1" | egrep MH_MAGIC | awk '{print $5}' ; exit ${PIPESTATUS[0]} )
        if [ $? -ne 0 ] ; then
                echo "Unable to rpathify $1 in $( pwd ): file type failed."
                exit 1