Packaging: Add a Logwolf NSIS config.

Create Logwolf-specific copies of the various Wireshark NSIS config files
and modify them to install and uninstall Logwolf. There are still a bunch
of rough edges, but the installer works for a test capture I have here.
This commit is contained in:
Gerald Combs 2022-04-27 14:38:38 -07:00
parent 06f0b78ce6
commit 8c7e3f0d30
13 changed files with 1832 additions and 49 deletions

View File

@ -30,8 +30,10 @@ endif()
if(WIN32)
set(_project_name Wireshark)
set(_log_project_name Logwolf)
else()
set(_project_name wireshark)
set(_log_project_name logwolf)
endif()
project(${_project_name} C CXX)
@ -50,6 +52,11 @@ endif()
set(PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION}")
set(LOG_PROJECT_NAME ${_log_project_name})
set(LOG_PROJECT_MAJOR_VERSION 0)
set(LOG_PROJECT_MINOR_VERSION 8)
set(LOG_PROJECT_VERSION "${LOG_PROJECT_MAJOR_VERSION}.${LOG_PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION}")
include( CMakeOptions.txt )
# We require minimum C11

View File

@ -12,7 +12,7 @@
set(WIRESHARK_NSIS_GENERATED_FILES
${CMAKE_CURRENT_BINARY_DIR}/wireshark-manifest.nsh
${CMAKE_CURRENT_BINARY_DIR}/config.nsh
${CMAKE_CURRENT_BINARY_DIR}/wireshark-config.nsh
${CMAKE_CURRENT_BINARY_DIR}/wireshark-qt-manifest.nsh
)
set(WIRESHARK_NSIS_GENERATED_FILES ${WIRESHARK_NSIS_GENERATED_FILES} PARENT_SCOPE)
@ -30,8 +30,29 @@ set(WIRESHARK_NSIS_FILES
PARENT_SCOPE
)
set(LOGWOLF_NSIS_GENERATED_FILES
${CMAKE_CURRENT_BINARY_DIR}/logwolf-manifest.nsh
${CMAKE_CURRENT_BINARY_DIR}/logwolf-config.nsh
${CMAKE_CURRENT_BINARY_DIR}/logwolf-qt-manifest.nsh
)
set(LOGWOLF_NSIS_GENERATED_FILES ${LOGWOLF_NSIS_GENERATED_FILES} PARENT_SCOPE)
set(LOGWOLF_NSIS_FILES
logwolf.nsi
uninstall-logwolf.nsi
logwolf-common.nsh
GetWindowsVersion.nsh
servicelib.nsh
AdditionalTasksPage.ini
NpcapPage.ini
USBPcapPage.ini
${LOGWOLF_NSIS_GENERATED_FILES}
PARENT_SCOPE
)
# Variables required for config.nsh
set(PROGRAM_NAME ${CMAKE_PROJECT_NAME})
set(LOG_PROGRAM_NAME ${LOG_PROJECT_NAME})
file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}" TOP_SRC_DIR)
# STAGING_DIR depends on the build configuration so we pass it
# on the command line below.
@ -50,21 +71,21 @@ set(NPCAP_PACKAGE_VERSION "1.60")
set(USBPCAP_PACKAGE_VERSION "1.5.4.0")
set(PRODUCT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.${PROJECT_BUILD_VERSION})
# To do:
# - Sync the various version names between CMake and NSIS.
# - Set CMakeLists.txt version strings in tools/make-version.pl
# - Add a VERSION_EXTRA cmake option
set (VERSION "${PROJECT_VERSION}")
set (PRODUCT_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}.${VERSION_BUILD})
set (VERSION ${PROJECT_VERSION})
set (PRODUCT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.${PROJECT_BUILD_VERSION})
set (LOG_VERSION ${LOG_PROJECT_VERSION})
set (LOG_PRODUCT_VERSION ${LOG_PROJECT_MAJOR_VERSION}.${LOG_PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.${PROJECT_BUILD_VERSION})
#add_custom_target(build_nsis_package
# DEPENDS
# wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe
#)
if(BUILD_wireshark AND QT_FOUND)
if((BUILD_wireshark OR BUILD_logwolf) AND QT_FOUND)
set (QT_DIR "\${STAGING_DIR}")
endif()
@ -131,41 +152,81 @@ if(_vcredist)
get_filename_component(VCREDIST_EXE ${_vcredist} NAME)
endif()
# Ideally we would generate this at compile time using a separate cmake
# module, e.g. cmake/modules/configure_nsis_file.cmake. However we would
# have to figure out a clean way to pass in the variables above.
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/config.nsh.in" _config_nsh_contents)
string(CONFIGURE "${_config_nsh_contents}" _config_nsh_contents)
string(REPLACE "#define" "!define" _config_nsh_contents "${_config_nsh_contents}")
string(REPLACE "#undef" "!undef" _config_nsh_contents "${_config_nsh_contents}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.nsh" "${_config_nsh_contents}")
if (BUILD_wireshark)
# Ideally we would generate this at compile time using a separate cmake
# module, e.g. cmake/modules/configure_nsis_file.cmake. However we would
# have to figure out a clean way to pass in the variables above.
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/wireshark-config.nsh.in" _config_nsh_contents)
string(CONFIGURE "${_config_nsh_contents}" _config_nsh_contents)
string(REPLACE "#define" "!define" _config_nsh_contents "${_config_nsh_contents}")
string(REPLACE "#undef" "!undef" _config_nsh_contents "${_config_nsh_contents}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/wireshark-config.nsh" "${_config_nsh_contents}")
# wireshark-manifest.nsh. Can be created at configure time.
set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/wireshark-manifest.nsh")
set(_all_manifest_contents "# Files required for all sections. Generated by CMake.\n")
set(_all_manifest_contents "${_all_manifest_contents}!ifdef BUNDLE_DEBUG_DLLS\n")
foreach(_dll ${GLIB2_DLLS_DEBUG})
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
set(_all_manifest_contents "${_all_manifest_contents}!else\n")
foreach(_dll ${GLIB2_DLLS_RELEASE})
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
set(_all_manifest_contents "${_all_manifest_contents}!endif\n")
foreach(_dll ${CARES_DLL} ${PCRE2_DLL} ${GCRYPT_DLLS}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLLS} ${LUA_DLL}
${LZ4_DLL} ${NGHTTP2_DLL} ${SBC_DLL} ${SMI_DLL} ${SNAPPY_DLL}
${SPANDSP_DLL} ${BCG729_DLL} ${LIBXML2_DLLS} ${WINSPARKLE_DLL}
${ZLIB_DLL} ${BROTLI_DLLS} ${ZSTD_DLL} ${ILBC_DLL} ${OPUS_DLL}
# Needed for mmdbresolve
${MAXMINDDB_DLL}
)
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
foreach(_script "init.lua" "console.lua" "dtd_gen.lua")
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_script}\"\n")
endforeach()
file(WRITE "${_all_manifest}" "${_all_manifest_contents}")
# wireshark-manifest.nsh. Can be created at configure time.
set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/wireshark-manifest.nsh")
set(_all_manifest_contents "# Files required for all sections. Generated by CMake.\n")
set(_all_manifest_contents "${_all_manifest_contents}!ifdef BUNDLE_DEBUG_DLLS\n")
foreach(_dll ${GLIB2_DLLS_DEBUG})
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
set(_all_manifest_contents "${_all_manifest_contents}!else\n")
foreach(_dll ${GLIB2_DLLS_RELEASE})
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
set(_all_manifest_contents "${_all_manifest_contents}!endif\n")
foreach(_dll ${CARES_DLL} ${PCRE2_DLL} ${GCRYPT_DLLS}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLLS} ${LUA_DLL}
${LZ4_DLL} ${NGHTTP2_DLL} ${SBC_DLL} ${SMI_DLL} ${SNAPPY_DLL}
${SPANDSP_DLL} ${BCG729_DLL} ${LIBXML2_DLLS} ${WINSPARKLE_DLL}
${ZLIB_DLL} ${BROTLI_DLLS} ${ZSTD_DLL} ${ILBC_DLL} ${OPUS_DLL}
# Needed for mmdbresolve
${MAXMINDDB_DLL}
)
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
foreach(_script "init.lua" "console.lua" "dtd_gen.lua")
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_script}\"\n")
endforeach()
file(WRITE "${_all_manifest}" "${_all_manifest_contents}")
endif()
if (BUILD_logwolf)
# Ideally we would generate this at compile time using a separate cmake
# module, e.g. cmake/modules/configure_nsis_file.cmake. However we would
# have to figure out a clean way to pass in the variables above.
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/logwolf-config.nsh.in" _config_nsh_contents)
string(CONFIGURE "${_config_nsh_contents}" _config_nsh_contents)
string(REPLACE "#define" "!define" _config_nsh_contents "${_config_nsh_contents}")
string(REPLACE "#undef" "!undef" _config_nsh_contents "${_config_nsh_contents}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/logwolf-config.nsh" "${_config_nsh_contents}")
# logwolf-manifest.nsh. Can be created at configure time.
set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/logwolf-manifest.nsh")
set(_all_manifest_contents "# Files required for all sections. Generated by CMake.\n")
set(_all_manifest_contents "${_all_manifest_contents}!ifdef BUNDLE_DEBUG_DLLS\n")
foreach(_dll ${GLIB2_DLLS_DEBUG})
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
set(_all_manifest_contents "${_all_manifest_contents}!else\n")
foreach(_dll ${GLIB2_DLLS_RELEASE})
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
set(_all_manifest_contents "${_all_manifest_contents}!endif\n")
foreach(_dll ${CARES_DLL} ${PCRE2_DLL} ${GCRYPT_DLLS}
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLLS} ${LUA_DLL}
${LZ4_DLL} ${NGHTTP2_DLL} ${SBC_DLL} ${SMI_DLL} ${SNAPPY_DLL}
${SPANDSP_DLL} ${BCG729_DLL} ${LIBXML2_DLLS} ${WINSPARKLE_DLL}
${ZLIB_DLL} ${BROTLI_DLLS} ${ZSTD_DLL} ${ILBC_DLL} ${OPUS_DLL}
# Needed for mmdbresolve
${MAXMINDDB_DLL}
)
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
endforeach()
foreach(_script "init.lua" "console.lua" "dtd_gen.lua")
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_script}\"\n")
endforeach()
file(WRITE "${_all_manifest}" "${_all_manifest_contents}")
endif()
file(TO_NATIVE_PATH "${DATAFILE_DIR}" _staging_dir)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" _outfile_dir)
@ -205,6 +266,18 @@ macro( ADD_NSIS_UNINSTALLER_TARGETS )
else()
message(WARNING "The NSIS installer cannot be built if the Wireshark program isn't built.")
endif()
if(BUILD_logwolf)
add_custom_command(OUTPUT ${DATAFILE_DIR}/uninstall-logwolf.exe
DEPENDS ${_nsis_source_dir}/uninstall-logwolf.nsi
${_nsis_source_dir}/logwolf-common.nsh
COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS}
uninstall-logwolf.nsi
COMMAND ${POWERSHELL_COMMAND} "${_nsis_source_dir}/makeUninstall.ps1" ${DATAFILE_DIR}/uninstall_logwolf_installer.exe
COMMAND ${CMAKE_COMMAND} -E remove ${DATAFILE_DIR}/uninstall_logwolf_installer.exe
WORKING_DIRECTORY ${_nsis_source_dir}
)
endif()
endmacro( ADD_NSIS_UNINSTALLER_TARGETS )
macro( ADD_NSIS_PACKAGE_TARGETS )
@ -259,14 +332,63 @@ macro( ADD_NSIS_PACKAGE_TARGETS )
EXCLUDE_FROM_DEFAULT_BUILD True
)
endif()
if(BUILD_logwolf)
#set (_nsis_package ${CMAKE_BINARY_DIR}/packaging/nsis/Wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe)
# logwolf-qt-manifest.nsh. Created using Wireshark.exe.
add_custom_command(OUTPUT ${_nsis_binary_dir}/logwolf-qt-manifest.nsh
COMMAND set "PATH=${QT_BIN_PATH};%PATH%"
COMMAND ${POWERSHELL_COMMAND} "${_nsis_source_dir}/windeployqt-to-nsis.ps1"
-Executable $<TARGET_FILE:logwolf>
-FilePath ${_nsis_binary_dir}/logwolf-qt-manifest.nsh
$<$<CONFIG:Debug>:-DebugConfig>
DEPENDS "${_nsis_source_dir}/windeployqt-to-nsis.ps1"
)
# Build NSIS package dependencies. We build the package in
# two stages so that logwolf_nsis below doesn't trigger
# any dependencies that might clobber any signed executables.
add_custom_target(logwolf_nsis_prep
DEPENDS
${LOGWOLF_NSIS_FILES}
copy_data_files
user_guide_html
faq_html
${DATAFILE_DIR}/uninstall-logwolf.exe
)
set_target_properties(logwolf_nsis_prep PROPERTIES
FOLDER "Packaging"
EXCLUDE_FROM_DEFAULT_BUILD True
)
# Dump the installer into
# ${CMAKE_CURRENT_SOURCE_DIR}/packaging/nsis
# Note that executables and DLLs *must* be built separately
add_custom_target(logwolf_nsis
COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS}
$<$<CONFIG:Debug>:/DBUNDLE_DEBUG_DLLS>
logwolf.nsi
WORKING_DIRECTORY ${_nsis_source_dir}
)
set_target_properties(logwolf_nsis PROPERTIES
FOLDER "Packaging"
EXCLUDE_FROM_DEFAULT_BUILD True
)
endif()
endmacro( ADD_NSIS_PACKAGE_TARGETS )
set(CLEAN_FILES
wireshark-manifest.nsh
config.nsh
#NEWS.txt
wireshark-qt-manifest.nsh
#user-guide.chm
${DATAFILE_DIR}/uninstall-wireshark.exe
wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe
wireshark-config.nsh
wireshark-manifest.nsh
wireshark-qt-manifest.nsh
${DATAFILE_DIR}/uninstall-logwolf.exe
logwolf-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe
logwolf-config.nsh
logwolf-manifest.nsh
logwolf-qt-manifest.nsh
)

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file was created by NSISDialogDesigner 1.5.0.0
https://coolsoft.altervista.org/nsisdialogdesigner
Do not edit manually!
-->
<Dialog Name="AdditionalTasksPage" Title="Additional Tasks" Subtitle="Create shortcuts and associate file extensions.">
<CreateFunctionCustomScript>; Defined in logwolf.nsi
Call InitAdditionalTasksPage</CreateFunctionCustomScript>
<Label Name="ExtensionsLabel" Location="22, 151" Size="372, 52" Text="Extensions include 5vw, acp, apc, atc, bfr, cap, enc, erf, fdc, ipfix, lcap, mplog, ntar, out, pcap, pcapng, pklg, pkt, rf5, snoop, syc, tpc, tr1, trace, trc, vwr, wpc, and wpz." TabIndex="0" />
<CheckBox Name="AssociateExtensionsCheckBox" Location="22, 126" Size="406, 14" Text="Associate trace file extensions with Logwolf" TabIndex="1" />
<CheckBox Name="QuickLaunchCheckBox" Location="22, 74" Size="406, 14" Text="Logwolf Quick Launch Icon" TabIndex="2" />
<CheckBox Name="DesktopIconCheckBox" Location="22, 54" Size="406, 14" Text="Logwolf Desktop Icon" TabIndex="3" />
<CheckBox Name="StartMenuCheckBox" Location="22, 34" Size="406, 14" Text="Logwolf Start Menu Item" TabIndex="4" />
<Label Name="FileExtensionsLabel" Location="12, 101" Size="426, 14" Text="Associate File Extensions" Font="Microsoft Sans Serif, 8.25pt, style=Bold" TabIndex="5" />
<Label Name="CreateShortcutsLabel" Location="12, 9" Size="426, 14" Text="Create Shortcuts" Font="Microsoft Sans Serif, 8.25pt, style=Bold" TabIndex="6" />
</Dialog>

View File

@ -0,0 +1,75 @@
; =========================================================
; This file was generated by NSISDialogDesigner 1.5.0.0
; https://coolsoft.altervista.org/nsisdialogdesigner
;
; Do not edit it manually, use NSISDialogDesigner instead!
; =========================================================
; handle variables
Var hCtl_AdditionalTasksPage
Var hCtl_AdditionalTasksPage_ExtensionsLabel
Var hCtl_AdditionalTasksPage_AssociateExtensionsCheckBox
Var hCtl_AdditionalTasksPage_QuickLaunchCheckBox
Var hCtl_AdditionalTasksPage_DesktopIconCheckBox
Var hCtl_AdditionalTasksPage_StartMenuCheckBox
Var hCtl_AdditionalTasksPage_FileExtensionsLabel
Var hCtl_AdditionalTasksPage_CreateShortcutsLabel
Var hCtl_AdditionalTasksPage_Font1
; dialog create function
Function fnc_AdditionalTasksPage_Create
; custom font definitions
CreateFont $hCtl_AdditionalTasksPage_Font1 "Microsoft Sans Serif" "8.25" "700"
; === AdditionalTasksPage (type: Dialog) ===
nsDialogs::Create 1018
Pop $hCtl_AdditionalTasksPage
${If} $hCtl_AdditionalTasksPage == error
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Additional Tasks" "Create shortcuts and associate file extensions."
; === ExtensionsLabel (type: Label) ===
${NSD_CreateLabel} 14u 93u 245u 32u "Extensions include scap."
Pop $hCtl_AdditionalTasksPage_ExtensionsLabel
; === AssociateExtensionsCheckBox (type: Checkbox) ===
${NSD_CreateCheckbox} 14u 78u 267u 9u "Associate log file extensions with Logwolf"
Pop $hCtl_AdditionalTasksPage_AssociateExtensionsCheckBox
; === QuickLaunchCheckBox (type: Checkbox) ===
${NSD_CreateCheckbox} 14u 46u 267u 9u "Logwolf Quick Launch Icon"
Pop $hCtl_AdditionalTasksPage_QuickLaunchCheckBox
; === DesktopIconCheckBox (type: Checkbox) ===
${NSD_CreateCheckbox} 14u 33u 267u 9u "Logwolf Desktop Icon"
Pop $hCtl_AdditionalTasksPage_DesktopIconCheckBox
; === StartMenuCheckBox (type: Checkbox) ===
${NSD_CreateCheckbox} 14u 21u 267u 9u "Logwolf Start Menu Item"
Pop $hCtl_AdditionalTasksPage_StartMenuCheckBox
; === FileExtensionsLabel (type: Label) ===
${NSD_CreateLabel} 8u 62u 280u 9u "Associate File Extensions"
Pop $hCtl_AdditionalTasksPage_FileExtensionsLabel
SendMessage $hCtl_AdditionalTasksPage_FileExtensionsLabel ${WM_SETFONT} $hCtl_AdditionalTasksPage_Font1 0
; === CreateShortcutsLabel (type: Label) ===
${NSD_CreateLabel} 8u 6u 280u 9u "Create Shortcuts"
Pop $hCtl_AdditionalTasksPage_CreateShortcutsLabel
SendMessage $hCtl_AdditionalTasksPage_CreateShortcutsLabel ${WM_SETFONT} $hCtl_AdditionalTasksPage_Font1 0
; CreateFunctionCustomScript
; Defined in logwolf.nsi
Call InitAdditionalTasksPage
FunctionEnd
; dialog show function
Function fnc_AdditionalTasksPage_Show
Call fnc_AdditionalTasksPage_Create
nsDialogs::Show
FunctionEnd

View File

@ -0,0 +1,128 @@
; ============================================================================
; Name and version information
; ============================================================================
Unicode true
; This improves the installer's appearance considerably here on a display scaled
; to 225%, but checkboxes are comically small. We might be able to fix this
; using the SysCompImg extension:
; http://forums.winamp.com/showthread.php?t=443754
ManifestDPIAware true
; These might be correct in the future, but are currently undocumented:
; http://forums.winamp.com/showthread.php?t=452632
; ManifestDPIAware System
; ManifestDPIAwareness "PerMonitorV2,System"
!ifdef NSIS_INCLUDE_DIR
!addincludedir ${NSIS_INCLUDE_DIR}
!endif
!include "logwolf-config.nsh"
!define BITS 64
!define DISPLAY_NAME "${PROGRAM_NAME} ${VERSION} ${BITS}-bit"
Name "${DISPLAY_NAME}"
!define PROGRAM_FULL_NAME "The ${PROGRAM_NAME} Log Analyzer"
!define PROGRAM_NAME_PATH "${PROGRAM_NAME}.exe"
!define UNINSTALLER_NAME "uninstall-logwolf.exe"
VIAddVersionKey "ProductName" "${PROGRAM_NAME}"
VIAddVersionKey "Comments" "It's a great product with a great story to tell. I'm pumped!"
VIAddVersionKey "CompanyName" "${PROGRAM_NAME} development team"
; NSIS handles U+00a9 but not a UTF-8 encoded copyright symbol.
VIAddVersionKey "LegalCopyright" "${U+00a9} Gerald Combs and many others"
VIAddVersionKey "LegalTrademarks" "Logwolf and the 'wolf' logo are registered trademarks"
VIAddVersionKey "FileDescription" "${PROGRAM_NAME} installer for ${BITS}-bit Windows"
VIAddVersionKey "Language" "English"
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
VIProductVersion "${PRODUCT_VERSION}"
XPStyle on
; ============================================================================
; Functions and macros
; ============================================================================
; Used to refresh the display of file association
!define SHCNE_ASSOCCHANGED 0x08000000
!define SHCNF_IDLIST 0
!macro UpdateIcons
Push $R0
Push $R1
Push $R2
!define UPDATEICONS_UNIQUE ${__LINE__}
IfFileExists "$SYSDIR\shell32.dll" UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE} UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}
UpdateIcons.ok_shell32_${UPDATEICONS_UNIQUE}:
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
UpdateIcons.error_shell32_${UPDATEICONS_UNIQUE}:
MessageBox MB_OK|MB_ICONSTOP \
"Can't find 'shell32.dll' library. Impossible to update icons" \
/SD IDOK
Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
!undef UPDATEICONS_UNIQUE
Pop $R2
Pop $R1
Pop $R0
; Force the icon cache to refresh
; https://superuser.com/questions/499078/refresh-icon-cache-without-rebooting
IfFileExists "$SYSDIR\ie4uinit.exe" 0 +2
Exec '"$SYSDIR\ie4uinit.exe" -ClearIconCache'
!macroend
; ============================================================================
; Push our known file extensions onto the stack, prepended with a marker
; Note that this is a subset of dump_open_table in wiretap/file_access.c. We
; probably don't want to grab JPEG or MP3 files.
; ============================================================================
; Used to add associations between file extensions and Logwolf
!define LOGWOLF_ASSOC "logwolf-log-file"
!define FILE_EXTENSION_MARKER "FILE_EXTENSION_MARKER"
!macro PushFileExtensions
Push "${FILE_EXTENSION_MARKER}"
Push ".scap"
!macroend
!macro IsLogwolfRunning
; See if Logwolf is running
; https://nsis.sourceforge.io/Check_whether_your_application_is_running
${Do}
System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "Global\${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
IntCmp $R0 0 checkRunningSession
System::Call 'kernel32::CloseHandle(i $R0)'
Goto isRunning
checkRunningSession:
System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "${PROGRAM_NAME}-is-running-{9CA78EEA-EA4D-4490-9240-FC01FCEF464B}") i .R0'
IntCmp $R0 0 notRunning
System::Call 'kernel32::CloseHandle(i $R0)'
isRunning:
; You'd better go catch it.
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PROGRAM_NAME} or one of its associated programs is running.$\r$\nPlease close it first." /SD IDCANCEL IDRETRY continueChecking
Quit
notRunning:
${ExitDo}
continueChecking:
${Loop}
!macroend

View File

@ -0,0 +1,31 @@
# ============================================================================
# NSIS configuration definitions. Generated from wireshark-config.nsh.in.
# ============================================================================
# Do not prefix comments with ";". They will be removed by CMake.
# MUST match "<Product ... Name=" in wix/Wireshark.wxs.
#define PROGRAM_NAME "@LOG_PROGRAM_NAME@"
#define TOP_SRC_DIR "@TOP_SRC_DIR@"
#define WIRESHARK_TARGET_PLATFORM @WIRESHARK_TARGET_PLATFORM@
#define TARGET_MACHINE @TARGET_MACHINE@
#define EXTRA_INSTALLER_DIR "@EXTRA_INSTALLER_DIR@"
#define VERSION @LOG_VERSION@
#define PRODUCT_VERSION @LOG_PRODUCT_VERSION@
# Plugins
#define VERSION_MAJOR @PROJECT_MAJOR_VERSION@
#define VERSION_MINOR @PROJECT_MINOR_VERSION@
#define VCREDIST_DIR "@VCREDIST_DIR@"
#define VCREDIST_EXE "@VCREDIST_EXE@"
# Optional components
#cmakedefine MMDBRESOLVE_EXE @MMDBRESOLVE_EXE@
# Skip the User's Guide until we have one of our own.
#cmakeundefine DOCBOOK_DIR
#cmakedefine SMI_DIR "@SMI_DIR@"
#cmakedefine QT_DIR "@QT_DIR@"

1139
packaging/nsis/logwolf.nsi Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,268 @@
;
; uninstall-logwolf.nsi
;
; Create an installer that only writes an uninstaller.
; https://nsis.sourceforge.io/Signing_an_Uninstaller
!include "logwolf-common.nsh"
!include 'LogicLib.nsh'
!include x64.nsh
!include "StrFunc.nsh"
SetCompress off
OutFile "${STAGING_DIR}\uninstall_logwolf_installer.exe"
; InstType "un.Default (keep Personal Settings and Npcap)"
InstType "un.All (remove all)"
; Uninstaller icon
UninstallIcon "..\..\resources\icons\wiresharkinst.ico"
!include "MUI.nsh"
!define MUI_UNICON "..\..\resources\icons\wiresharkinst.ico"
; Uninstall stuff (NSIS 2.08: "\r\n" don't work here)
!define MUI_UNCONFIRMPAGE_TEXT_TOP "The following ${PROGRAM_NAME} installation will be removed. Click 'Next' to continue."
; Uninstall stuff (this text isn't used with the MODERN_UI!)
;UninstallText "This will uninstall ${PROGRAM_NAME}.\r\nBefore starting the uninstallation, make sure ${PROGRAM_NAME} is not running.\r\nClick 'Next' to continue."
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
; ============================================================================
; Section macros
; ============================================================================
!include "Sections.nsh"
; ============================================================================
; Uninstall page configuration
; ============================================================================
ShowUninstDetails show
; ============================================================================
; Functions and macros
; ============================================================================
Function .onInit
; MUST be the absolute path to our staging directory.
WriteUninstaller "${STAGING_DIR}\${UNINSTALLER_NAME}"
SetErrorLevel 0
Quit
FunctionEnd
Var EXTENSION
Function un.Disassociate
Push $R0
!insertmacro PushFileExtensions
Pop $EXTENSION
${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER}
ReadRegStr $R0 HKCR $EXTENSION ""
StrCmp $R0 ${LOGWOLF_ASSOC} un.Disassociate.doDeregister
Goto un.Disassociate.end
un.Disassociate.doDeregister:
; The extension is associated with Logwolf so, we must destroy this!
DeleteRegKey HKCR $EXTENSION
DetailPrint "Deregistered file type: $EXTENSION"
un.Disassociate.end:
Pop $EXTENSION
${Loop}
Pop $R0
FunctionEnd
Section "-Required"
SectionEnd
!define EXECUTABLE_MARKER "EXECUTABLE_MARKER"
Var EXECUTABLE
Section "Uninstall" un.SecUinstall
;-------------------------------------------
;
; UnInstall for every user
;
SectionIn 1 2
SetShellVarContext all
!insertmacro IsLogwolfRunning
Push "${EXECUTABLE_MARKER}"
Push "${PROGRAM_NAME}"
Push "capinfos"
Push "captype"
Push "dftest"
Push "dumpcap"
Push "editcap"
Push "mergecap"
Push "reordercap"
Push "text2pcap"
!ifdef MMDBRESOLVE_EXE
Push "mmdbresolve"
!endif
Pop $EXECUTABLE
${DoUntil} $EXECUTABLE == ${EXECUTABLE_MARKER}
; IsLogwolfRunning should make sure everything is closed down so we *shouldn't* run
; into any problems here.
Delete "$INSTDIR\$EXECUTABLE.exe"
IfErrors 0 deletionSuccess
MessageBox MB_OK "$EXECUTABLE.exe could not be removed. Is it in use?" /SD IDOK IDOK 0
Abort "$EXECUTABLE.exe could not be removed. Aborting the uninstall process."
deletionSuccess:
Pop $EXECUTABLE
${Loop}
DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "Software\${PROGRAM_NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\${PROGRAM_NAME}.exe"
Call un.Disassociate
DeleteRegKey HKCR ${LOGWOLF_ASSOC}
DeleteRegKey HKCR "${LOGWOLF_ASSOC}\Shell\open\command"
DeleteRegKey HKCR "${LOGWOLF_ASSOC}\DefaultIcon"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\*.html"
Delete "$INSTDIR\*.qm"
Delete "$INSTDIR\accessible\*.*"
Delete "$INSTDIR\AUTHORS-SHORT"
Delete "$INSTDIR\COPYING*"
Delete "$INSTDIR\audio\*.*"
Delete "$INSTDIR\bearer\*.*"
Delete "$INSTDIR\diameter\*.*"
Delete "$INSTDIR\help\*.*"
Delete "$INSTDIR\iconengines\*.*"
Delete "$INSTDIR\imageformats\*.*"
Delete "$INSTDIR\mediaservice\*.*"
Delete "$INSTDIR\platforms\*.*"
Delete "$INSTDIR\playlistformats\*.*"
Delete "$INSTDIR\printsupport\*.*"
Delete "$INSTDIR\share\glib-2.0\schemas\*.*"
Delete "$INSTDIR\snmp\*.*"
Delete "$INSTDIR\snmp\mibs\*.*"
Delete "$INSTDIR\styles\translations\*.*"
Delete "$INSTDIR\styles\*.*"
Delete "$INSTDIR\protobuf\*.*"
Delete "$INSTDIR\tpncp\*.*"
Delete "$INSTDIR\translations\*.*"
Delete "$INSTDIR\ui\*.*"
Delete "$INSTDIR\wimaxasncp\*.*"
Delete "$INSTDIR\ws.css"
Delete "$INSTDIR\README*"
Delete "$INSTDIR\NEWS.txt"
Delete "$INSTDIR\manuf"
Delete "$INSTDIR\wka"
Delete "$INSTDIR\services"
Delete "$INSTDIR\pdml2html.xsl"
Delete "$INSTDIR\pcrepattern.3.txt"
Delete "$INSTDIR\example_snmp_users_file"
Delete "$INSTDIR\ipmap.html"
Delete "$INSTDIR\radius\*.*"
Delete "$INSTDIR\dtds\*.*"
RMDir "$INSTDIR\accessible"
RMDir "$INSTDIR\audio"
RMDir "$INSTDIR\bearer"
RMDir "$INSTDIR\extcap"
RMDir "$INSTDIR\iconengines"
RMDir "$INSTDIR\imageformats"
RMDir "$INSTDIR\mediaservice"
RMDir "$INSTDIR\platforms"
RMDir "$INSTDIR\playlistformats"
RMDir "$INSTDIR\printsupport"
RMDir "$INSTDIR\styles\translations"
RMDir "$INSTDIR\styles"
RMDir "$SMPROGRAMS\${PROGRAM_NAME}"
RMDir "$INSTDIR\help"
;RMDir /r "$INSTDIR\Wireshark User's Guide"
RMDir "$INSTDIR\diameter"
RMDir "$INSTDIR\snmp\mibs"
RMDir "$INSTDIR\snmp"
RMDir "$INSTDIR\radius"
RMDir "$INSTDIR\dtds"
RMDir "$INSTDIR\protobuf"
RMDir "$INSTDIR\tpncp"
RMDir "$INSTDIR\translations"
RMDir "$INSTDIR\ui"
RMDir "$INSTDIR\wimaxasncp"
RMDir "$INSTDIR"
SectionEnd ; "Uinstall"
Section "Un.Plugins" un.SecPlugins
;-------------------------------------------
SectionIn 1 2
;Delete "$INSTDIR\plugins\${VERSION}\*.*"
;Delete "$INSTDIR\plugins\*.*"
;RMDir "$INSTDIR\plugins\${VERSION}"
;RMDir "$INSTDIR\plugins"
RMDir /r "$INSTDIR\plugins"
SectionEnd
Section "Un.Global Profiles" un.SecProfiles
;-------------------------------------------
SectionIn 1 2
RMDir /r "$INSTDIR\profiles"
SectionEnd
Section "Un.Global Settings" un.SecGlobalSettings
;-------------------------------------------
SectionIn 1 2
Delete "$INSTDIR\cfilters"
Delete "$INSTDIR\colorfilters"
Delete "$INSTDIR\dfilters"
Delete "$INSTDIR\enterprises.tsv"
Delete "$INSTDIR\init.lua"
Delete "$INSTDIR\console.lua"
Delete "$INSTDIR\dtd_gen.lua"
Delete "$INSTDIR\smi_modules"
RMDir "$INSTDIR"
SectionEnd
Section /o "Un.Personal Settings" un.SecPersonalSettings
;-------------------------------------------
SectionIn 2
SetShellVarContext current
Delete "$APPDATA\${PROGRAM_NAME}\*.*"
RMDir "$APPDATA\${PROGRAM_NAME}"
DeleteRegKey HKCU "Software\${PROGRAM_NAME}"
SectionEnd
Section "-Un.Finally"
;-------------------------------------------
SectionIn 1 2
!insertmacro UpdateIcons
; this test must be done after all other things uninstalled (e.g. Global Settings)
IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
MessageBox MB_OK "Unable to remove $INSTDIR." /SD IDOK IDOK 0 ; skipped if dir doesn't exist
NoFinalErrorMsg:
SectionEnd
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all ${PROGRAM_NAME} components."
!insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous ${PROGRAM_NAME} versions)."
!insertmacro MUI_DESCRIPTION_TEXT ${un.SecProfiles} "Uninstall all global configuration profiles."
!insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
!insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END

View File

@ -236,10 +236,6 @@ RMDir "$INSTDIR\mediaservice"
RMDir "$INSTDIR\platforms"
RMDir "$INSTDIR\playlistformats"
RMDir "$INSTDIR\printsupport"
RMDir "$INSTDIR\share\themes\Default\gtk-2.0"
RMDir "$INSTDIR\share\themes\Default"
RMDir "$INSTDIR\share\themes"
RMDir "$INSTDIR\share"
RMDir "$INSTDIR\styles\translations"
RMDir "$INSTDIR\styles"
RMDir "$SMPROGRAMS\${PROGRAM_NAME}"

View File

@ -1,5 +1,5 @@
# ============================================================================
# NSIS configuration definitions. Generated from config.nsh.in.
# NSIS configuration definitions. Generated from wireshark-config.nsh.in.
# ============================================================================
# Do not prefix comments with ";". They will be removed by CMake.

View File

@ -125,7 +125,7 @@ Page custom DisplayUSBPcapPage
; https://nsis.sourceforge.io/Docs/Modern%20UI%202/Readme.html
; https://nsis.sourceforge.io/Docs/nsDialogs/Readme.html
!ifdef QT_DIR
!include "AdditionalTasksPage.nsdinc"
!include "wireshark-additional-tasks.nsdinc"
!endif
; ============================================================================