From b392fc1d8ff590ac2400e68519472a10aece43c2 Mon Sep 17 00:00:00 2001 From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Fri, 19 Jan 2024 18:05:16 +0000 Subject: [PATCH] os_win32/installer.nsi: Avoid that code signing invalidates the uninstaller. git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5593 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/ChangeLog | 5 +++++ smartmontools/os_win32/installer.nsi | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog index 6e7f21e95..2b2e7da0a 100644 --- a/smartmontools/ChangeLog +++ b/smartmontools/ChangeLog @@ -1,5 +1,10 @@ $Id$ +2024-01-19 Christian Franke <franke@computer.org> + + os_win32/installer.nsi: Avoid that code signing invalidates the + uninstaller. + 2024-01-17 Christian Franke <franke@computer.org> utility.cpp: Add git commit hash to '-V' output if available. diff --git a/smartmontools/os_win32/installer.nsi b/smartmontools/os_win32/installer.nsi index fc3fd5dd3..460ec9e61 100644 --- a/smartmontools/os_win32/installer.nsi +++ b/smartmontools/os_win32/installer.nsi @@ -3,7 +3,7 @@ ; ; Home page of code is: https://www.smartmontools.org ; -; Copyright (C) 2006-23 Christian Franke +; Copyright (C) 2006-24 Christian Franke ; ; SPDX-License-Identifier: GPL-2.0-or-later ; @@ -261,6 +261,17 @@ Section "Uninstaller" UNINST_SECTION SectionEnd +; Run dummy "signing" command after creation of the uninstaller. +; This avoids that the uninstaller inherits the file header +; from the installer. Otherwise some header fields (checksum, +; security directory entry) of the uninstaller would be invalid if +; the installer file is later modified by code signing. +!if "${NSIS_PACKEDVERSION}" >= 0x03008000 ; Requires NSIS >= 3.08 + !uninstfinalize "echo uninstfinalize %1" +!else + !warning "NSIS ${NSIS_VERSION} (< v3.08): uninstaller may not work if installer is signed" +!endif + Section "Start Menu Shortcuts" MENU_SECTION SectionIn ${FULL_TYPES} -- GitLab