Old 22nd June 2022, 09:24   #1
arxot
Junior Member
 
Join Date: Jun 2022
Posts: 1
Adding file from uninstfinalize

Hi!

I use !uninstfinalize to produce a custom signature file (to verify the uninstaller). I need this signature file to be installed by the installer. Is this possible?

Whenever I think about this I end up with some sort of chicken-egg loop, but I don't completely understand when different things happen here, so maybe I'm missing something.

Cheers
arxot is offline   Reply With Quote
Old 22nd June 2022, 13:40   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 923
Maybe you can make it a two-step process: use a dummy installer that only has the uninstall code in it, and then in your installer you compile it with !makensis. In the dummy installer you can copy the uninstaller file to somewhere else using !uninstfinalize and run the sign tool on that. Then in the installer just include both files using 'File', and then use !finalize to delete the extra files.

Something like this:
PHP Code:
uninstall.nsi
OutFile dummy
.exe
Name 
"dummy installer" Replace this with your actual product name

Add MUI if you are using it
;!include "MUI2.nsh"

You can probably use a common header for things that are shared
between both installer and uninstaller
!addincludedir "."
!include "common.nsh"

!ifdef NSIS_WIN32_MAKENSIS
  
!uninstfinalize 'copy /Y /B "%1" "./uninstall.exe"' do not remember if this is right
  
!uninstfinalize 'customsign "uninstall.exe" "uninstall.sig"'
!else
  ; Or if 
you are not on windows
  
!uninstfinalize 'cp "%1" "./uninstall.exe"'
  
!uninstfinalize 'customsign "uninstall.exe" "uninstall.sig"'
!endif

Dummy page to keep the compiler happy
Page instfiles
Add your uninstaller pages here

Add your languages here

Section
  
Dummy "WriteUninstaller" so that !uninstfinalize works
  WriteUninstaller 
"$EXEDIR\uninstall.exe"
SectionEnd

All your uninstall code goes here
Section uninstall
SectionEnd 
PHP Code:
;installer.nsi
You can probably use a common header for things that are shared
between both installer and uninstaller
!addincludedir "."
!include "common.nsh"
....

Generate the uninstaller
!makensis "uninstall.nsi"
...

Section
  
Set the out dirthen point this to your files from uninstall.nsi
  File 
"uninstall.exe"
  
File "uninstall.sig"
SectionEnd

Clean up
!ifdef NSIS_WIN32_MAKENSIS
  
!finalize 'del dummy.exe'
  
!finalize 'del uninstall.exe'
  
!finalize 'del uninstall.sig'
!else
  ; Or 
not on windows
  
!finalize 'rm dummy.exe'
  
!finalize 'rm uninstall.exe'
  
!finalize 'rm uninstall.sig'
!endif 

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 22nd June 2022, 15:48   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,534
Why do you think you need to verify the uninstaller?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
uninstfinalize

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump