Add symlinks to Wireshark binaries in Resources/bin, and point there.

That way, $PATH points to .../Wireshark.app/Contents/Resources/bin, so
the man command will look in
.../Wireshark.app/Contents/Resources/share/man.

This also may obviate the need to install the wrapper scripts in
/usr/local/bin, although those scripts obviate the need to re-set PATH
after installing Wireshark.

Change-Id: I7202b5a0fe5d2b90c956dc0db2af073f6c08b00d
Reviewed-on: https://code.wireshark.org/review/19296
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-12-15 17:48:59 -08:00
parent 8234de5350
commit d706f9c221
3 changed files with 33 additions and 30 deletions

View File

@ -22,7 +22,7 @@ done
# Setting PATH
# if /etc/paths.d/Wireshark already exists we overwrite it.
#
WSPATH="$2/Wireshark.app/Contents/MacOS"
WSPATH="$2/Wireshark.app/Contents/Resources/bin"
if [ ! -d /etc/paths.d ]
then

View File

@ -52,8 +52,10 @@ bundle="Wireshark.app"
# Name of the Wireshark executable
wireshark_bin_name="wireshark"
binary_list="
$wireshark_bin_name
#
# Command-line executables
#
cli_binary_list="
capinfos
dftest
dumpcap
@ -187,7 +189,12 @@ fi
if [ "$create_bundle" = "true" ]; then
echo -e "\nCREATE WIRESHARK APP BUNDLE\n"
for binary in $binary_list ; do
if [ ! -x "$binary_path/$wireshark_bin_name" ]; then
echo "Couldn't find $binary_path/$wireshark_bin_name (or it's not executable)" >&2
exit 1
fi
for binary in $cli_binary_list ; do
binary=$( basename $binary )
if [ ! -x "$binary_path/$binary" ]; then
echo "Couldn't find $binary (or it's not executable)" >&2
@ -233,7 +240,7 @@ exclude_prefixes="$exclude_prefixes|$qt_frameworks_dir"
# Package paths
pkgexec="$bundle/Contents/MacOS"
pkgres="$bundle/Contents/Resources"
pkgbin="$pkgexec"
pkgbin="$pkgres/bin"
pkglib="$bundle/Contents/Frameworks"
pkgplugin="$bundle/Contents/PlugIns/wireshark"
@ -258,18 +265,17 @@ create_bundle() {
mkdir -p "$pkgbin"
mkdir -p "$pkgplugin"
cp -v "$binary_path/$wireshark_bin_name" "$pkgexec/Wireshark"
# Copy all files into the bundle
#----------------------------------------------------------
echo -e "\nFilling app bundle and utility directory...\n"
# Wireshark executables
for binary in $binary_list ; do
# Copy the binary to its destination
bin_dest="$pkgexec"
cp -v "$binary_path/$binary" "$bin_dest"
cs_binary_list="$cs_binary_list $bin_dest/$binary"
cp -v "$binary_path/$wireshark_bin_name" "$pkgexec/Wireshark"
cs_binary_list="$cs_binary_list $pkgexec/Wireshark"
for binary in $cli_binary_list ; do
# Copy the binary to the executable directory
cp -v "$binary_path/$binary" "$pkgexec"
cs_binary_list="$cs_binary_list $pkgexec/$binary"
done
#
@ -283,6 +289,14 @@ create_bundle() {
cs_binary_list="$cs_binary_list $bin_dest/$binary"
done
#
# Links to executables
#
ln -s ../../MacOS/Wireshark $pkgbin/wireshark
for binary in $cli_binary_list ; do
ln -s ../../MacOS/$binary $pkgbin/$binary
done
# The rest of the Wireshark installation (we handled bin above)
rsync -av \
--exclude bin/ \
@ -320,7 +334,7 @@ if [ "$create_bundle" = "true" ]; then
fi
if [ -z "$cs_binary_list" ]; then
for binary in Wireshark $binary_list ; do
for binary in Wireshark $cli_binary_list ; do
cs_binary_list="$cs_binary_list $pkgexec/$binary"
done
fi
@ -335,9 +349,8 @@ nfiles=0
endl=true
lib_dep_search_list="
$pkglib/*
$pkgbin/*-bin
$pkgbin/extcap/*
$pkgexec/Wireshark
$pkgexec/*
$pkgexec/extcap/*
"
while $endl; do
@ -388,7 +401,7 @@ macdeployqt "$bundle" -verbose=2 || exit 1
# pointing to the directory containing the Qt frameworks; remove
# that entry from the Wireshark binary in the package.
#
/usr/bin/install_name_tool -delete_rpath "$qt_frameworks_dir" $pkgbin/Wireshark
/usr/bin/install_name_tool -delete_rpath "$qt_frameworks_dir" $pkgexec/Wireshark
# NOTE: we must rpathify *all* files, *including* Qt libraries etc.,
#
@ -550,10 +563,10 @@ rpathify_files () {
# Fix bundle deps
#
rpathify_dir "$pkglib" "*.dylib"
rpathify_dir "$pkgbin" "*"
rpathify_dir "$pkgexec" "*"
rpathify_dir "$pkgplugin" "*"
rpathify_dir "$pkgbin/extcap" "*"
rpathify_dir "$pkgexec/extcap" "*"
}
PATHLENGTH=`echo $LIBPREFIX | wc -c`

View File

@ -18,14 +18,4 @@ fi
APP_NAME=`basename "$0"`
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
exec "$WIRESHARK_APP_DIR/Contents/Resources/bin/$APP_NAME" "$@"