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.8KB

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