aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/appimage/AppRun
blob: e6eee7274782aaa57c9663b9bcbfe727e152a925 (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
#!/bin/sh

# Custom AppRun entry point that allows symlinking multiple
# executables, e.g. wireshark, tshark, dumpcap, editcap, etc.

# Adapted from
# https://github.com/probonopd/ippsample/blob/feature/appimage/appimage/AppRun

SELF=$(readlink -f "$0")
HERE=${SELF%/*}

# See if we were called by runtime.c, which sets APPIMAGE, ARGV0,
# and APPDIR.
if [ -n "$APPIMAGE" ] && [ -n "$ARGV0" ] ; then
    BINARY_NAME=${ARGV0##*/}
else
    BINARY_NAME=${0##*/}
fi

if [ -e "$HERE/usr/bin/$BINARY_NAME" ] ; then
    exec "$HERE/usr/bin/$BINARY_NAME" "$@"
else
    exec "$HERE/usr/bin/wireshark" "$@"
fi