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.

setup.nsi 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. Name Bitcoin
  2. RequestExecutionLevel highest
  3. SetCompressor /SOLID lzma
  4. # General Symbol Definitions
  5. !define REGKEY "SOFTWARE\$(^Name)"
  6. !define VERSION 0.6.99
  7. !define COMPANY "Bitcoin project"
  8. !define URL http://www.bitcoin.org/
  9. # MUI Symbol Definitions
  10. !define MUI_ICON "../share/pixmaps/bitcoin.ico"
  11. !define MUI_WELCOMEFINISHPAGE_BITMAP "../share/pixmaps/nsis-wizard.bmp"
  12. !define MUI_HEADERIMAGE
  13. !define MUI_HEADERIMAGE_RIGHT
  14. !define MUI_HEADERIMAGE_BITMAP "../share/pixmaps/nsis-header.bmp"
  15. !define MUI_FINISHPAGE_NOAUTOCLOSE
  16. !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
  17. !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
  18. !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
  19. !define MUI_STARTMENUPAGE_DEFAULTFOLDER Bitcoin
  20. !define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin-qt.exe
  21. !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
  22. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "../share/pixmaps/nsis-wizard.bmp"
  23. !define MUI_UNFINISHPAGE_NOAUTOCLOSE
  24. # Included files
  25. !include Sections.nsh
  26. !include MUI2.nsh
  27. # Variables
  28. Var StartMenuGroup
  29. # Installer pages
  30. !insertmacro MUI_PAGE_WELCOME
  31. !insertmacro MUI_PAGE_DIRECTORY
  32. !insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
  33. !insertmacro MUI_PAGE_INSTFILES
  34. !insertmacro MUI_PAGE_FINISH
  35. !insertmacro MUI_UNPAGE_CONFIRM
  36. !insertmacro MUI_UNPAGE_INSTFILES
  37. # Installer languages
  38. !insertmacro MUI_LANGUAGE English
  39. # Installer attributes
  40. OutFile bitcoin-0.6.99-win32-setup.exe
  41. InstallDir $PROGRAMFILES\Bitcoin
  42. CRCCheck on
  43. XPStyle on
  44. BrandingText " "
  45. ShowInstDetails show
  46. VIProductVersion 0.6.99.0
  47. VIAddVersionKey ProductName Bitcoin
  48. VIAddVersionKey ProductVersion "${VERSION}"
  49. VIAddVersionKey CompanyName "${COMPANY}"
  50. VIAddVersionKey CompanyWebsite "${URL}"
  51. VIAddVersionKey FileVersion "${VERSION}"
  52. VIAddVersionKey FileDescription ""
  53. VIAddVersionKey LegalCopyright ""
  54. InstallDirRegKey HKCU "${REGKEY}" Path
  55. ShowUninstDetails show
  56. # Installer sections
  57. Section -Main SEC0000
  58. SetOutPath $INSTDIR
  59. SetOverwrite on
  60. File ../release/bitcoin-qt.exe
  61. File /oname=license.txt ../COPYING
  62. File /oname=readme.txt ../doc/README_windows.txt
  63. SetOutPath $INSTDIR\daemon
  64. File ../src/bitcoind.exe
  65. SetOutPath $INSTDIR\src
  66. File /r /x *.exe /x *.o ../src\*.*
  67. SetOutPath $INSTDIR
  68. WriteRegStr HKCU "${REGKEY}\Components" Main 1
  69. # Remove old wxwidgets-based-bitcoin executable and locales:
  70. Delete /REBOOTOK $INSTDIR\bitcoin.exe
  71. RMDir /r /REBOOTOK $INSTDIR\locale
  72. SectionEnd
  73. Section -post SEC0001
  74. WriteRegStr HKCU "${REGKEY}" Path $INSTDIR
  75. SetOutPath $INSTDIR
  76. WriteUninstaller $INSTDIR\uninstall.exe
  77. !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  78. CreateDirectory $SMPROGRAMS\$StartMenuGroup
  79. CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk" $INSTDIR\bitcoin-qt.exe
  80. CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk" $INSTDIR\uninstall.exe
  81. !insertmacro MUI_STARTMENU_WRITE_END
  82. WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
  83. WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
  84. WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
  85. WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
  86. WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
  87. WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
  88. WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
  89. WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
  90. WriteRegStr HKCR "bitcoin" "URL Protocol" ""
  91. WriteRegStr HKCR "bitcoin" "" "URL:Bitcoin"
  92. WriteRegStr HKCR "bitcoin\DefaultIcon" "" $INSTDIR\bitcoin-qt.exe
  93. WriteRegStr HKCR "bitcoin\shell\open\command" "" '"$INSTDIR\bitcoin-qt.exe" "$$1"'
  94. SectionEnd
  95. # Macro for selecting uninstaller sections
  96. !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
  97. Push $R0
  98. ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"
  99. StrCmp $R0 1 0 next${UNSECTION_ID}
  100. !insertmacro SelectSection "${UNSECTION_ID}"
  101. GoTo done${UNSECTION_ID}
  102. next${UNSECTION_ID}:
  103. !insertmacro UnselectSection "${UNSECTION_ID}"
  104. done${UNSECTION_ID}:
  105. Pop $R0
  106. !macroend
  107. # Uninstaller sections
  108. Section /o -un.Main UNSEC0000
  109. Delete /REBOOTOK $INSTDIR\bitcoin-qt.exe
  110. Delete /REBOOTOK $INSTDIR\license.txt
  111. Delete /REBOOTOK $INSTDIR\readme.txt
  112. RMDir /r /REBOOTOK $INSTDIR\daemon
  113. RMDir /r /REBOOTOK $INSTDIR\src
  114. DeleteRegValue HKCU "${REGKEY}\Components" Main
  115. SectionEnd
  116. Section -un.post UNSEC0001
  117. DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
  118. Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall Bitcoin.lnk"
  119. Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Bitcoin.lnk"
  120. Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
  121. Delete /REBOOTOK $INSTDIR\uninstall.exe
  122. Delete /REBOOTOK $INSTDIR\debug.log
  123. Delete /REBOOTOK $INSTDIR\db.log
  124. DeleteRegValue HKCU "${REGKEY}" StartMenuGroup
  125. DeleteRegValue HKCU "${REGKEY}" Path
  126. DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components"
  127. DeleteRegKey /IfEmpty HKCU "${REGKEY}"
  128. DeleteRegKey HKCR "bitcoin"
  129. RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
  130. RmDir /REBOOTOK $INSTDIR
  131. Push $R0
  132. StrCpy $R0 $StartMenuGroup 1
  133. StrCmp $R0 ">" no_smgroup
  134. no_smgroup:
  135. Pop $R0
  136. SectionEnd
  137. # Installer functions
  138. Function .onInit
  139. InitPluginsDir
  140. FunctionEnd
  141. # Uninstaller functions
  142. Function un.onInit
  143. ReadRegStr $INSTDIR HKCU "${REGKEY}" Path
  144. !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
  145. !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
  146. FunctionEnd