Running Wireshark through a symlink doesn't work.

We can't just symbolically link to the executables, as that means that
the executable won't be in Contents/MacOS, which means that all
@executable_path-relative references will go to the wrong place if we
run the executables using the symlink, which means that the executables
could fail (they *do* fail to find the Cocoa Qt plugin, for example).

So, instead, we go back to the old version of the utility launcher, and
put that in Contents/Resources/bin as well as, if the user requests the
CLI utilities, /usr/local/bin.  Maybe PackageMaker will find that
acceptable and include them in the installer package.

Bug: 13270
Change-Id: I4016b58c9ce0df05d78525d35e53431750c2b4d9
Reviewed-on: https://code.wireshark.org/review/19536
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-01-04 03:05:14 -08:00
parent 0aba97a938
commit 2cc215c7d0
3 changed files with 22 additions and 21 deletions

View File

@ -19,26 +19,10 @@ do
rm -f "$PLUGINS_PATH"/$plugin.so "$PLUGINS_PATH"/$plugin.la
done
BIN_PATH="$2/Wireshark.app/Contents/Resources/bin"
#
# For some reason, packagemaker isn't including Contents/Resources/bin
# in the app bundle, so let's just construct it ourselves.
#
if [ ! -d "$BIN_PATH" ]
then
mkdir -m u=rwx,g=rx,o=rx "$BIN_PATH"
fi
for i in capinfos dftest dumpcap editcap mergecap randpkt rawshark \
tshark text2pcap
do
ln -s ../../MacOS/"$i" "$BIN_PATH/$i"
done
ln -s ../../MacOS/Wireshark "$BIN_PATH/wireshark"
# Setting PATH
# if /etc/paths.d/Wireshark already exists we overwrite it.
#
WSPATH="$BIN_PATH"
WSPATH="$2/Wireshark.app/Contents/MacOS"
if [ ! -d /etc/paths.d ]
then

View File

@ -290,11 +290,18 @@ create_bundle() {
done
#
# Links to executables
# Executable launchers in $pkgbin
#
ln -s ../../MacOS/Wireshark $pkgbin/wireshark
# We can't just symbolically link to the executables, as
# that means that the executable won't be in Contents/MacOS,
# which means that all @executable_path-relative references
# will go to the wrong place if we run the executables using
# the symlink, which means that the executables could fail
# (they *do* fail to find the Cocoa Qt plugin, for example).
#
cp utility-launcher/wireshark $pkgbin
for binary in $cli_binary_list ; do
ln -s ../../MacOS/$binary $pkgbin/$binary
ln -s ./wireshark $pkgbin/$binary
done
# The rest of the Wireshark installation (we handled bin above)

View File

@ -18,4 +18,14 @@ fi
APP_NAME=`basename "$0"`
exec "$WIRESHARK_APP_DIR/Contents/Resources/bin/$APP_NAME" "$@"
APP_CONTENTS="$WIRESHARK_APP_DIR/Contents"
if [ -f "$APP_CONTENTS/Frameworks/QtWidgets" -o -d "$APP_CONTENTS/Frameworks/QtWidgets.framework" ] ; then
# Qt
if [ "$APP_NAME" = "wireshark" ] ; then
APP_NAME=Wireshark
fi
exec "$APP_CONTENTS/MacOS/$APP_NAME" "$@"
else
# GTK+
exec "$APP_CONTENTS/Resources/bin/$APP_NAME" "$@"
fi