diff --git a/CMakeLists.txt b/CMakeLists.txt index 093c5c2106..3fd7bd639a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/doc/tshark.adoc b/doc/tshark.adoc index acbdc92fdd..137611612c 100644 --- a/doc/tshark.adoc +++ b/doc/tshark.adoc @@ -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:: + diff --git a/doc/wireshark.adoc b/doc/wireshark.adoc index 45746b1644..bfddf910a6 100644 --- a/doc/wireshark.adoc +++ b/doc/wireshark.adoc @@ -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:: + diff --git a/packaging/appimage/Wireshark-AppRun b/packaging/appimage/Wireshark-AppRun deleted file mode 100644 index e6eee72747..0000000000 --- a/packaging/appimage/Wireshark-AppRun +++ /dev/null @@ -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 diff --git a/packaging/appimage/Wireshark-AppRun.in b/packaging/appimage/Wireshark-AppRun.in new file mode 100644 index 0000000000..c3bc06fc5a --- /dev/null +++ b/packaging/appimage/Wireshark-AppRun.in @@ -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 diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index 6e5ba34889..a463a01974 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -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