You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

install.nsi 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. ;NSIS Modern User Interface
  2. ;Basic Example Script
  3. ;Written by Joost Verburg
  4. ;--------------------------------
  5. ;Include Modern UI
  6. !define Vendor "sdbarker"
  7. !define Title "Digester"
  8. !include "MUI2.nsh"
  9. ;--------------------------------
  10. ;General
  11. SetCompressor /FINAL /SOLID lzma
  12. ;Name and file
  13. Name "${Title} Installer"
  14. OutFile "${Title} Installer.exe"
  15. ;Default installation folder
  16. InstallDir "$PROGRAMFILES"
  17. ;Get installation folder from registry if available
  18. InstallDirRegKey HKCU "Software\${Vendor}\${Title}" ""
  19. ;Request application privileges for Windows Vista
  20. RequestExecutionLevel user
  21. ;--------------------------------
  22. ;Interface Settings
  23. !define MUI_ABORTWARNING
  24. ;--------------------------------
  25. ;Pages
  26. !insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
  27. !insertmacro MUI_PAGE_COMPONENTS
  28. !insertmacro MUI_PAGE_DIRECTORY
  29. !insertmacro MUI_PAGE_INSTFILES
  30. !insertmacro MUI_UNPAGE_CONFIRM
  31. !insertmacro MUI_UNPAGE_INSTFILES
  32. ;--------------------------------
  33. ;Languages
  34. !insertmacro MUI_LANGUAGE "English"
  35. ;--------------------------------
  36. ;Installer Sections
  37. Section "${Title}" SecMain
  38. SetOutPath "$INSTDIR"
  39. CreateDirectory "$INSTDIR\${Vendor}\${Title}"
  40. File DigesterCLI\bin\Release\DigesterCLI.exe
  41. File DigesterGUI\bin\Release\DigesterGUI.exe
  42. File DigesterCommon\bin\Release\DigesterCommon.dll
  43. File DigestProviders\bin\Release\*.dll
  44. File EncodingProviders\bin\Release\*.dll
  45. File OptionParser\bin\Release\*.dll
  46. SectionEnd
  47. Section ""
  48. WriteRegStr HKCR "*" "" "Digester.AllFiles"
  49. ;menu-name,submenu,icon
  50. WriteRegStr HKCR \
  51. "Digester.AllFiles\shell\Digester.ContextMenu" \
  52. "MUIVerb" \
  53. "Digester"
  54. WriteRegStr HKCR \
  55. "Digester.AllFiles\shell\Digester.ContextMenu" \
  56. "ExtendedSubCommandsKey" \
  57. "Digester.AllFiles\ContextMenu"
  58. WriteRegStr HKCR \
  59. "Digester.AllFiles\shell\Digester.ContextMenu" \
  60. "Icon" \
  61. "$INSTDIR\DigesterGUI.exe,1"
  62. ;compile
  63. WriteRegStr HKCR \
  64. "Digester.AllFiles\ContextMenu\shell\compile" \
  65. "MUIVerb" "Digester Hex MD5"
  66. WriteRegStr HKCR \
  67. "Digester.AllFiles\ContextMenu\shell\compile\command" \
  68. "" \
  69. '"$INSTDIR\DigesterGUI.exe" "-e hex -d md5 -f -d %1"'
  70. SectionEnd
  71. Section "-Uninstaller" SecUninstaller
  72. ; Store installation folder
  73. WriteRegStr HKCU "Software\${Vendor}\${Title}" "" $INSTDIR
  74. ; Create uninstaller
  75. CreateDirectory "$PROGRAMFILES\${Vendor}\${Title}"
  76. WriteUninstaller "$PROGRAMFILES\${Vendor}\${Title}\Uninstall.exe"
  77. ; Add uninstaller to Add/Remove Programs (Programs and Features in Vista+)
  78. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Title}" "DisplayName" "${Title}"
  79. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Title}" "UninstallString" "$\"$PROGRAMFILES\${Vendor}\${Title}\Uninstall.exe$\""
  80. SectionEnd
  81. ;--------------------------------
  82. ;Descriptions
  83. ;Language strings
  84. LangString DESC_SecMain ${LANG_ENGLISH} "Digester GUI and CLI"
  85. LangString DESC_SecUninstaller ${LANG_ENGLISH} "Adds an uninstaller to remove the configs later."
  86. ;Assign language strings to sections
  87. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  88. !insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_SecMain)
  89. !insertmacro MUI_DESCRIPTION_TEXT ${SecUninstaller} $(DESC_SecUninstaller)
  90. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  91. ;--------------------------------
  92. ;Uninstaller Section
  93. Section "Uninstall"
  94. ; Remove installed files here
  95. Delete "$PROGRAMFILES\${Vendor}\${Title}\Uninstall.exe"
  96. Delete "$INSTDIR\*"
  97. RMDir /r "$PROGRAMFILES\${Vendor}\${Title}"
  98. RMDir /r "$PROGRAMFILES\${Vendor}"
  99. DeleteRegKey HKCU "Software\${Vendor}\${Title}"
  100. DeleteRegKey /ifempty HKCU "Software\${Vendor}"
  101. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Title}"
  102. SectionEnd