HAG NSIS Installer Script.nsi 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. ; example2.nsi
  2. ;
  3. ; This script is based on example1.nsi, but it remember the directory,
  4. ; has uninstall support and (optionally) installs start menu shortcuts.
  5. ;
  6. ; It will install example2.nsi into a directory that the user selects,
  7. ;--------------------------------
  8. ; Include Modern UI
  9. !include "MUI2.nsh"
  10. ;--------------------------------
  11. ; The name of the installer
  12. Name "Hybrid Application Generator"
  13. ; Installer branding
  14. ; BrandingText "Nokia Hybrid Application Generator"
  15. ; Better compression
  16. SetCompressor /SOLID lzma
  17. SetOverwrite ifnewer
  18. CRCCheck on
  19. ; The file to write
  20. OutFile "Nokia HAG Installer.exe"
  21. ; The default installation directory
  22. InstallDir "$PROGRAMFILES\Nokia\Hybrid Application Generator"
  23. ; Registry key to check for directory (so if you install again, it will
  24. ; overwrite the old one automatically)
  25. InstallDirRegKey HKLM "Software\Nokia\Hybrid Application Generator\Installer" "Install_Dir"
  26. ; Request application privileges for Windows Vista
  27. RequestExecutionLevel user
  28. ;--------------------------------
  29. ; Interface Settings
  30. !define MUI_ABORTWARNING
  31. ;--------------------------------
  32. ; Pages
  33. !insertmacro MUI_PAGE_LICENSE "release_current\License.txt"
  34. !insertmacro MUI_PAGE_COMPONENTS
  35. !insertmacro MUI_PAGE_DIRECTORY
  36. !insertmacro MUI_PAGE_INSTFILES
  37. # These indented statements modify settings for MUI_PAGE_FINISH
  38. !define MUI_FINISHPAGE_NOAUTOCLOSE
  39. !define MUI_FINISHPAGE_RUN
  40. !define MUI_FINISHPAGE_RUN_NOTCHECKED
  41. !define MUI_FINISHPAGE_RUN_TEXT "Run Hybrid Application Generator"
  42. !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchApplication"
  43. ; !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
  44. !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
  45. !insertmacro MUI_PAGE_FINISH
  46. !insertmacro MUI_UNPAGE_CONFIRM
  47. !insertmacro MUI_UNPAGE_COMPONENTS
  48. !insertmacro MUI_UNPAGE_INSTFILES
  49. !insertmacro MUI_UNPAGE_FINISH
  50. ;--------------------------------
  51. ;Languages
  52. !insertmacro MUI_LANGUAGE "English"
  53. ;--------------------------------
  54. ; The stuff to install
  55. Section "Core Application" Core
  56. SectionIn RO
  57. ; Set output path to the installation directory.
  58. SetOutPath $INSTDIR
  59. ; Put the files
  60. File /r /x examples release_current\*.*
  61. ; Write the installation path into the registry
  62. WriteRegStr HKLM "Software\Nokia\Hybrid Application Generator" "Install_Dir" "$INSTDIR"
  63. ; Write the uninstall keys for Windows
  64. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Hybrid Application Generator" "DisplayName" "Nokia Hybrid Application Generator"
  65. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Hybrid Application Generator" "UninstallString" '"$INSTDIR\uninstall.exe"'
  66. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Hybrid Application Generator" "NoModify" 1
  67. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Hybrid Application Generator" "NoRepair" 1
  68. WriteUninstaller "uninstall.exe"
  69. SectionEnd
  70. ; Examples -- optional
  71. Section "Demo Applications" Demos
  72. SetOutPath $INSTDIR\examples
  73. File /r release_current\examples\*.*
  74. SetOutPath $INSTDIR
  75. SectionEnd
  76. ; Optional section (can be disabled by the user)
  77. Section "Start Menu Shortcuts" Shortcuts
  78. CreateDirectory "$SMPROGRAMS\Nokia Hybrid Application Generator"
  79. CreateShortCut "$SMPROGRAMS\Nokia Hybrid Application Generator\Hybrid Application Generator.lnk" "$INSTDIR\HAG.exe" "" "$INSTDIR\HAG.exe" 0
  80. CreateShortCut "$SMPROGRAMS\Nokia Hybrid Application Generator\Documentation.lnk" "$INSTDIR\HAG User Guide.pdf" "" "$INSTDIR\HAG User Guide.pdf" 0
  81. CreateShortCut "$SMPROGRAMS\Nokia Hybrid Application Generator\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  82. SectionEnd
  83. ;--------------------------------
  84. ; Section descriptions
  85. LangString DESC_Core ${LANG_ENGLISH} "Installs Hybrid Application Generator main executable, framework files, and the default set of HAG plugins."
  86. LangString DESC_Demos ${LANG_ENGLISH} "Installs demo applications. The demo applications are introduced in the HAG User Guide."
  87. LangString DESC_Shortcuts ${LANG_ENGLISH} "Installs start menu shortcuts for easier access to application."
  88. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  89. !insertmacro MUI_DESCRIPTION_TEXT ${Core} $(DESC_Core)
  90. !insertmacro MUI_DESCRIPTION_TEXT ${Demos} $(DESC_Demos)
  91. !insertmacro MUI_DESCRIPTION_TEXT ${Shortcuts} $(DESC_Shortcuts)
  92. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  93. ;--------------------------------
  94. ; Uninstaller
  95. Section "un.Core Application" un.Core
  96. SectionIn RO
  97. ; Remove registry keys
  98. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Hybrid Application Generator"
  99. DeleteRegKey HKLM "Software\Nokia\Hybrid Application Generator"
  100. ; Remove the application. Do not use simple recursive $INSTDIR removal, since that will actually cause
  101. ; the removal of the current directory of uninstall.exe, potentially wiping out everything.
  102. RMDir /r "$INSTDIR\examples"
  103. RMDir /r "$INSTDIR\fw"
  104. RMDir /r "$INSTDIR\iconengines"
  105. RMDir /r "$INSTDIR\oxygen-icons"
  106. RMDir /r "$INSTDIR\imageformats"
  107. RMDir /r "$INSTDIR\mw"
  108. RMDir /r "$INSTDIR\templates"
  109. ; HAG executables, guide, and default log file
  110. Delete /REBOOTOK "$INSTDIR\HAG User Guide.pdf"
  111. Delete /REBOOTOK "$INSTDIR\HAG.exe"
  112. Delete /REBOOTOK "$INSTDIR\launcher.exe"
  113. Delete /REBOOTOK "$INSTDIR\unzip.exe"
  114. Delete /REBOOTOK "$INSTDIR\wget.exe"
  115. Delete /REBOOTOK "$INSTDIR\uninstall.exe"
  116. Delete /REBOOTOK "$INSTDIR\hag.log"
  117. ; HAG runtimes
  118. Delete /REBOOTOK "$INSTDIR\msvcr90.dll"
  119. Delete /REBOOTOK "$INSTDIR\Qt*.dll"
  120. Delete /REBOOTOK "$INSTDIR\phonon4.dll"
  121. Delete /REBOOTOK "$INSTDIR\hybridfw.dll"
  122. Delete /REBOOTOK "$INSTDIR\locationapi.dll"
  123. ; wget runtimes
  124. Delete /REBOOTOK "$INSTDIR\libeay32.dll"
  125. Delete /REBOOTOK "$INSTDIR\libiconv2.dll"
  126. Delete /REBOOTOK "$INSTDIR\libintl3.dll"
  127. Delete /REBOOTOK "$INSTDIR\libssl32.dll"
  128. ; Licenses, readme
  129. Delete /REBOOTOK "$INSTDIR\License.txt";
  130. Delete /REBOOTOK "$INSTDIR\Readme.txt"
  131. ; Now, this will only work if the directory is empty
  132. RMDir "$INSTDIR"
  133. ; Remove shortcuts, if any
  134. Delete "$SMPROGRAMS\Nokia Hybrid Application Generator\*.*"
  135. ; Remove directories used
  136. RMDir "$SMPROGRAMS\Nokia Hybrid Application Generator"
  137. RMDir "$INSTDIR"
  138. SectionEnd
  139. Section /o "un.Preferences" un.Preferences
  140. ; Remove permanent settings from the current user
  141. DeleteRegKey HKCU "Software\Nokia\Hybrid Application Generator"
  142. SectionEnd
  143. ;--------------------------------
  144. ; Section descriptions
  145. LangString DESC_un.Core ${LANG_ENGLISH} "Removes Hybrid Application Generator main executable, framework files, plugins, demo applications, and start menu shortcuts."
  146. LangString DESC_un.Preferences ${LANG_ENGLISH} "Removes Hybrid Application Generator permanent settings."
  147. !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
  148. !insertmacro MUI_DESCRIPTION_TEXT ${un.Core} $(DESC_un.Core)
  149. !insertmacro MUI_DESCRIPTION_TEXT ${un.Preferences} $(DESC_un.Preferences)
  150. !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
  151. ;--------------------------------
  152. ; Launch application?
  153. Function LaunchApplication
  154. ExecShell "" "$INSTDIR\HAG.exe"
  155. FunctionEnd