Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !macro UNINSTBUILDER_GENERATE localbindef unique
  2. !define __UNBLDR_UNIQ "_UNBLDR${unique}" ;somewhat unique
  3. !define __UNBLDR_LOCUNBIN "$%temp%\${__UNBLDR_UNIQ}un.exe"
  4. !if "${localbindef}" != ""
  5.     !define ${localbindef} "${__UNBLDR_LOCUNBIN}"
  6. !endif
  7. !appendfile "$%temp%\${__UNBLDR_UNIQ}" '!include "${__FILE__}"$\n'
  8. !appendfile "$%temp%\${__UNBLDR_UNIQ}" 'outfile "$%temp%\${__UNBLDR_UNIQ}.exe"$\nSilentInstall silent$\nSection$\n'
  9. !appendfile "$%temp%\${__UNBLDR_UNIQ}" 'WriteUninstaller "$%temp%\${__UNBLDR_UNIQ}un.exe"$\nSectionEnd$\n'
  10. !system '"${NSISDIR}\MakeNsis.exe" /NOCD /DBUILDUNINSTALLER "$%temp%\${__UNBLDR_UNIQ}"'  = 0
  11. !delfile "$%temp%\${__UNBLDR_UNIQ}"
  12. !system '"$%temp%\${__UNBLDR_UNIQ}.exe"' = 0
  13. !delfile "$%temp%\${__UNBLDR_UNIQ}.exe"
  14. !undef __UNBLDR_UNIQ
  15. !macroend
  16. !macro UNINSTBUILDER_WRITE destpath
  17. File "/oname=${destpath}" "${__UNBLDR_LOCUNBIN}"
  18. !delfile "${__UNBLDR_LOCUNBIN}"
  19. !macroend
  20.  
  21.  
  22. !define APPNAME "UninstallerSignTest"
  23. name "${APPNAME}"
  24. outfile "$%temp%\${APPNAME}.exe"
  25. installdir "$temp\untest"
  26. setcompressor /solid lzma
  27. VIProductVersion "1.2.3.4"
  28. VIAddVersionKey "LegalCopyright" "© Fake company"
  29. VIAddVersionKey "FileDescription" "${APPNAME} desc"
  30. VIAddVersionKey "FileVersion" "1.2.3"
  31.  
  32. !ifNdef BUILDUNINSTALLER
  33. !insertmacro UNINSTBUILDER_GENERATE localuninst "${APPNAME}"
  34. !echo "Do something with uninstaller: ${localuninst}"
  35. VIAddVersionKey "Comments" "Installer"
  36.  
  37. page directory
  38. page instfiles
  39.  
  40. Section
  41. Setoutpath -
  42. !insertmacro UNINSTBUILDER_WRITE "$instdir\uninstaller.exe"
  43. MessageBox mb_yesno "Uninstall now?" IDNO nope
  44. Exec '"$instdir\uninstaller.exe"'
  45. quit
  46. nope:
  47. SectionEnd
  48.  
  49.  
  50. !else
  51. VIAddVersionKey "Comments" "Uninstaller"
  52.  
  53. UninstPage uninstconfirm
  54. UninstPage instfiles
  55.  
  56. Section -un.Uninstaller
  57. MessageBox mb_ok "Hello from uninstaller"
  58. Delete "$instdir\uninstaller.exe"
  59. RMDir "$instdir"
  60. SectionEnd
  61. !endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement