Merge #9953: Fix shutdown hang with >= 8 -addnodes set
[bitcoinplatinum.git] / share / setup.nsi.in
blobdd42085a27609232a3e2c3c35085077e3cfb777e
1 Name "@PACKAGE_NAME@ (@WINDOWS_BITS@-bit)"
3 RequestExecutionLevel highest
4 SetCompressor /SOLID lzma
6 # General Symbol Definitions
7 !define REGKEY "SOFTWARE\$(^Name)"
8 !define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@
9 !define COMPANY "@PACKAGE_NAME@ project"
10 !define URL @PACKAGE_URL@
12 # MUI Symbol Definitions
13 !define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico"
14 !define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp"
15 !define MUI_HEADERIMAGE
16 !define MUI_HEADERIMAGE_RIGHT
17 !define MUI_HEADERIMAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-header.bmp"
18 !define MUI_FINISHPAGE_NOAUTOCLOSE
19 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
20 !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
21 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
22 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "@PACKAGE_NAME@"
23 !define MUI_FINISHPAGE_RUN $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@
24 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
25 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp"
26 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
28 # Included files
29 !include Sections.nsh
30 !include MUI2.nsh
31 !if "@WINDOWS_BITS@" == "64"
32 !include x64.nsh
33 !endif
35 # Variables
36 Var StartMenuGroup
38 # Installer pages
39 !insertmacro MUI_PAGE_WELCOME
40 !insertmacro MUI_PAGE_DIRECTORY
41 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
42 !insertmacro MUI_PAGE_INSTFILES
43 !insertmacro MUI_PAGE_FINISH
44 !insertmacro MUI_UNPAGE_CONFIRM
45 !insertmacro MUI_UNPAGE_INSTFILES
47 # Installer languages
48 !insertmacro MUI_LANGUAGE English
50 # Installer attributes
51 OutFile @abs_top_srcdir@/@PACKAGE_TARNAME@-${VERSION}-win@WINDOWS_BITS@-setup.exe
52 !if "@WINDOWS_BITS@" == "64"
53 InstallDir $PROGRAMFILES64\Bitcoin
54 !else
55 InstallDir $PROGRAMFILES\Bitcoin
56 !endif
57 CRCCheck on
58 XPStyle on
59 BrandingText " "
60 ShowInstDetails show
61 VIProductVersion ${VERSION}.@CLIENT_VERSION_BUILD@
62 VIAddVersionKey ProductName "@PACKAGE_NAME@"
63 VIAddVersionKey ProductVersion "${VERSION}"
64 VIAddVersionKey CompanyName "${COMPANY}"
65 VIAddVersionKey CompanyWebsite "${URL}"
66 VIAddVersionKey FileVersion "${VERSION}"
67 VIAddVersionKey FileDescription ""
68 VIAddVersionKey LegalCopyright ""
69 InstallDirRegKey HKCU "${REGKEY}" Path
70 ShowUninstDetails show
72 # Installer sections
73 Section -Main SEC0000
74 SetOutPath $INSTDIR
75 SetOverwrite on
76 File @abs_top_srcdir@/release/@BITCOIN_GUI_NAME@@EXEEXT@
77 File /oname=COPYING.txt @abs_top_srcdir@/COPYING
78 File /oname=readme.txt @abs_top_srcdir@/doc/README_windows.txt
79 SetOutPath $INSTDIR\daemon
80 File @abs_top_srcdir@/release/@BITCOIN_DAEMON_NAME@@EXEEXT@
81 File @abs_top_srcdir@/release/@BITCOIN_CLI_NAME@@EXEEXT@
82 SetOutPath $INSTDIR\doc
83 File /r @abs_top_srcdir@/doc\*.*
84 SetOutPath $INSTDIR
85 WriteRegStr HKCU "${REGKEY}\Components" Main 1
86 SectionEnd
88 Section -post SEC0001
89 WriteRegStr HKCU "${REGKEY}" Path $INSTDIR
90 SetOutPath $INSTDIR
91 WriteUninstaller $INSTDIR\uninstall.exe
92 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
93 CreateDirectory $SMPROGRAMS\$StartMenuGroup
94 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@
95 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet, @WINDOWS_BITS@-bit).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 1
96 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
97 !insertmacro MUI_STARTMENU_WRITE_END
98 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
99 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
100 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
101 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
102 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
103 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
104 WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
105 WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
106 WriteRegStr HKCR "@PACKAGE_TARNAME@" "URL Protocol" ""
107 WriteRegStr HKCR "@PACKAGE_TARNAME@" "" "URL:Bitcoin"
108 WriteRegStr HKCR "@PACKAGE_TARNAME@\DefaultIcon" "" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@
109 WriteRegStr HKCR "@PACKAGE_TARNAME@\shell\open\command" "" '"$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "%1"'
110 SectionEnd
112 # Macro for selecting uninstaller sections
113 !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
114 Push $R0
115 ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"
116 StrCmp $R0 1 0 next${UNSECTION_ID}
117 !insertmacro SelectSection "${UNSECTION_ID}"
118 GoTo done${UNSECTION_ID}
119 next${UNSECTION_ID}:
120 !insertmacro UnselectSection "${UNSECTION_ID}"
121 done${UNSECTION_ID}:
122 Pop $R0
123 !macroend
125 # Uninstaller sections
126 Section /o -un.Main UNSEC0000
127 Delete /REBOOTOK $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@
128 Delete /REBOOTOK $INSTDIR\COPYING.txt
129 Delete /REBOOTOK $INSTDIR\readme.txt
130 RMDir /r /REBOOTOK $INSTDIR\daemon
131 RMDir /r /REBOOTOK $INSTDIR\doc
132 DeleteRegValue HKCU "${REGKEY}\Components" Main
133 SectionEnd
135 Section -un.post UNSEC0001
136 DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
137 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
138 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk"
139 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet, @WINDOWS_BITS@-bit).lnk"
140 Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
141 Delete /REBOOTOK $INSTDIR\uninstall.exe
142 Delete /REBOOTOK $INSTDIR\debug.log
143 Delete /REBOOTOK $INSTDIR\db.log
144 DeleteRegValue HKCU "${REGKEY}" StartMenuGroup
145 DeleteRegValue HKCU "${REGKEY}" Path
146 DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components"
147 DeleteRegKey /IfEmpty HKCU "${REGKEY}"
148 DeleteRegKey HKCR "@PACKAGE_TARNAME@"
149 RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
150 RmDir /REBOOTOK $INSTDIR
151 Push $R0
152 StrCpy $R0 $StartMenuGroup 1
153 StrCmp $R0 ">" no_smgroup
154 no_smgroup:
155 Pop $R0
156 SectionEnd
158 # Installer functions
159 Function .onInit
160 InitPluginsDir
161 !if "@WINDOWS_BITS@" == "64"
162 ${If} ${RunningX64}
163 ; disable registry redirection (enable access to 64-bit portion of registry)
164 SetRegView 64
165 ${Else}
166 MessageBox MB_OK|MB_ICONSTOP "Cannot install 64-bit version on a 32-bit system."
167 Abort
168 ${EndIf}
169 !endif
170 FunctionEnd
172 # Uninstaller functions
173 Function un.onInit
174 ReadRegStr $INSTDIR HKCU "${REGKEY}" Path
175 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
176 !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
177 FunctionEnd