summaryrefslogtreecommitdiff
path: root/packaging/macosx/utility-launcher/wireshark
blob: e412a5024cb20c773dc4fe49ed1d474b22065e70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
#
# Wireshark CLI utility launcher

if [ -z "$WIRESHARK_APP_DIR" ] ; then
	WIRESHARK_APP_DIR="/Applications/Wireshark.app"
fi

if [ ! -d "$WIRESHARK_APP_DIR" ] ; then
	WIRESHARK_APP_DIR=`mdfind "kMDItemCFBundleIdentifier == 'org.wireshark.Wireshark'" | head -n 1`
fi

if [ ! -d "$WIRESHARK_APP_DIR" ] ; then
	echo "Wireshark doesn't appear to be located at $WIRESHARK_APP_DIR."
	echo "Please set WIRESHARK_APP_DIR to its proper location and try again."
	exit 1
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