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.in 6.9KB

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