summaryrefslogtreecommitdiffstats
path: root/packaging/appimage/Logray-AppRun.in
blob: 87698570bf68df08a2d79df8127e7db15a6d4710 (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
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

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

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

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

# https://github.com/AppImage/AppImageKit/issues/126
export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}"

# We should probably set these relative to the program path in
# wsutil/filesystem.c
if [ -z "$LOGRAY_DATA_DIR" ] ; then
    export LOGRAY_DATA_DIR="$APPDIR@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/wireshark"
fi

if [ -z "$LOGRAY_EXTCAP_DIR" ] ; then
    export LOGRAY_EXTCAP_DIR="$APPDIR@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/wireshark/extcap"
fi

if [ -z "$LOGRAY_PLUGIN_DIR" ] ; then
    export LOGRAY_PLUGIN_DIR="$APPDIR@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/wireshark/plugins"
fi

# 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/logray" "$@"
fi