AppRun: Set various paths

Set our ld library path and our data, extcap, and plugin directories.
Document WIRESHARK_EXTCAP_DIR and WIRESHARK_PLUGIN_DIR. Note that we
might want to set our various directories relative to the program path.
This commit is contained in:
Gerald Combs 2023-01-17 14:07:33 -08:00
parent a5eb85a1d6
commit 5a9812ab61
6 changed files with 81 additions and 40 deletions

View File

@ -3654,6 +3654,7 @@ if(RPMBUILD_EXECUTABLE)
endif()
if(LINUXDEPLOY_EXECUTABLE AND _linuxdeploy_plugin_qt AND APPIMAGETOOL_EXECUTABLE)
configure_file(packaging/appimage/Wireshark-AppRun.in ${CMAKE_BINARY_DIR}/packaging/appimage/Wireshark-AppRun @ONLY)
# Require production builds (/usr + Release).
if (CMAKE_BUILD_TYPE STREQUAL "Release" AND CMAKE_INSTALL_PREFIX STREQUAL "/usr" )
add_custom_target(wireshark_appimage_prerequisites)
@ -3688,7 +3689,7 @@ if(LINUXDEPLOY_EXECUTABLE AND _linuxdeploy_plugin_qt AND APPIMAGETOOL_EXECUTABLE
${_wireshark_appimage_exe_args}
--desktop-file=${_wireshark_ai_appdir}/usr/share/applications/org.wireshark.Wireshark.desktop
--icon-file=${CMAKE_SOURCE_DIR}/resources/icons/wsicon256.png
--custom-apprun=${CMAKE_SOURCE_DIR}/packaging/appimage/Wireshark-AppRun
--custom-apprun=${CMAKE_BINARY_DIR}/packaging/appimage/Wireshark-AppRun
--plugin=qt
DEPENDS wireshark_appimage_appdir
)
@ -4087,7 +4088,7 @@ if(SHELLCHECK_EXECUTABLE)
add_custom_command(TARGET shellcheck POST_BUILD
COMMAND shellcheck --external-sources
resources/stock_icons/svg-to-png.sh
packaging/appimage/Wireshark-AppRun
packaging/appimage/Wireshark-AppRun.in
"packaging/macosx/ChmodBPF/root/Library/Application Support/Wireshark/ChmodBPF/ChmodBPF"
packaging/macosx/osx-app.sh.in
packaging/macosx/osx-dmg.sh.in

View File

@ -1361,8 +1361,8 @@ want to generate the statistics; currently the supported ones are:
"zbee_nwk" ZigBee Network Layer addresses
The table is presented with one line for each conversation which displays
the number of frames/bytes in each direction, the total number of
frames/bytes, relative start time and duration.
the number of frames/bytes in each direction, the total number of
frames/bytes, relative start time and duration.
The table is sorted according to the total number of frames.
--
@ -2861,12 +2861,16 @@ with root (or setuid) permissions on *NIX.
--
WIRESHARK_DATA_DIR::
+
--
This environment variable causes the various data files to be loaded from
a directory other than the standard locations. It has no effect when the
program in question is running with root (or setuid) permissions on *NIX.
--
Overrides the default global configuration directory.
It has no effect when the program in question is running with root (or setuid) permissions on *NIX.
WIRESHARK_EXTCAP_DIR::
Overrides the default extcap directory.
It has no effect when the program in question is running with root (or setuid) permissions on *NIX.
WIRESHARK_PLUGIN_DIR::
Overrides the default plugin directory.
It has no effect when the program in question is running with root (or setuid) permissions on *NIX.
ERF_RECORDS_TO_CHECK::
+

View File

@ -2969,12 +2969,16 @@ with root (or setuid) permissions on *NIX.
--
WIRESHARK_DATA_DIR::
+
--
This environment variable causes the various data files to be loaded from
a directory other than the standard locations. It has no effect when the
program in question is running with root (or setuid) permissions on *NIX.
--
Overrides the default global configuration directory.
It has no effect when the program in question is running with root (or setuid) permissions on *NIX.
WIRESHARK_EXTCAP_DIR::
Overrides the default extcap directory.
It has no effect when the program in question is running with root (or setuid) permissions on *NIX.
WIRESHARK_PLUGIN_DIR::
Overrides the default plugin directory.
It has no effect when the program in question is running with root (or setuid) permissions on *NIX.
ERF_RECORDS_TO_CHECK::
+

View File

@ -1,24 +0,0 @@
#!/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

View File

@ -0,0 +1,41 @@
#!/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%/*}
# 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 "$WIRESHARK_DATA_DIR" ] ; then
export WIRESHARK_DATA_DIR="$APPDIR@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/wireshark"
fi
if [ -z "$WIRESHARK_EXTCAP_DIR" ] ; then
export WIRESHARK_EXTCAP_DIR="$APPDIR@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/wireshark/extcap"
fi
if [ -z "$WIRESHARK_PLUGIN_DIR" ] ; then
export WIRESHARK_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/wireshark" "$@"
fi

View File

@ -1033,6 +1033,11 @@ get_datafile_dir(void)
*/
datafile_dir = g_strdup(progfile_dir);
} else {
/*
* XXX We might want want to make this relative to progfile_dir, which would
* allow installation into arbitrary directories and provide better AppImage
* support.
*/
datafile_dir = g_strdup(DATA_DIR);
}
#endif
@ -1142,6 +1147,11 @@ init_plugin_dir(void)
}
#endif
else {
/*
* XXX We might want want to make this relative to progfile_dir, which would
* allow installation into arbitrary directories and provide better AppImage
* support.
*/
plugin_dir = g_strdup(PLUGIN_DIR);
}
}
@ -1277,6 +1287,11 @@ init_extcap_dir(void)
}
#endif
else {
/*
* XXX We might want want to make this relative to progfile_dir, which would
* allow installation into arbitrary directories and provide better AppImage
* support.
*/
extcap_dir = g_strdup(EXTCAP_DIR);
}
#endif