1#!/bin/sh
2
3# Custom AppRun entry point that allows symlinking multiple
4# executables, e.g. wireshark, tshark, dumpcap, editcap, etc.
5
6# Adapted from
7# https://github.com/probonopd/ippsample/blob/feature/appimage/appimage/AppRun
8
9SELF=$(readlink -f "$0")
10HERE=${SELF%/*}
11
12# See if we were called by runtime.c, which sets APPIMAGE, ARGV0,
13# and APPDIR.
14if [ -n "$APPIMAGE" ] && [ -n "$ARGV0" ] ; then
15    BINARY_NAME=${ARGV0##*/}
16else
17    BINARY_NAME=${0##*/}
18fi
19
20if [ -e "$HERE/usr/bin/$BINARY_NAME" ] ; then
21    exec "$HERE/usr/bin/$BINARY_NAME" "$@"
22else
23    exec "$HERE/usr/bin/wireshark" "$@"
24fi
25