NSIS.template.in 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. ;ownCloud installer script.
  2. !define APPLICATION_SHORTNAME "@APPLICATION_EXECUTABLE@"
  3. !define APPLICATION_NAME "@APPLICATION_NAME@"
  4. !define APPLICATION_VENDOR "@APPLICATION_VENDOR@"
  5. !define APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@.exe"
  6. !define APPLICATION_CMD_EXECUTABLE "@APPLICATION_EXECUTABLE@cmd.exe"
  7. !define APPLICATION_DOMAIN "@APPLICATION_DOMAIN@"
  8. !define APPLICATION_LICENSE "@APPLICATION_LICENSE@"
  9. !define WIN_SETUP_BITMAP_PATH "@WIN_SETUP_BITMAP_PATH@"
  10. !define CRASHREPORTER_EXECUTABLE "@CRASHREPORTER_EXECUTABLE@"
  11. ;-----------------------------------------------------------------------------
  12. ; Some installer script options (comment-out options not required)
  13. ;-----------------------------------------------------------------------------
  14. !if "@APPLICATION_LICENSE@" != ""
  15. !define OPTION_LICENSE_AGREEMENT
  16. !endif
  17. !define OPTION_UAC_PLUGIN_ENHANCED
  18. !define OPTION_SECTION_SC_SHELL_EXT
  19. !define OPTION_SECTION_SC_START_MENU
  20. !define OPTION_SECTION_SC_DESKTOP
  21. !define OPTION_SECTION_SC_QUICK_LAUNCH
  22. !define OPTION_FINISHPAGE
  23. !define OPTION_FINISHPAGE_LAUNCHER
  24. ; !define OPTION_FINISHPAGE_RELEASE_NOTES
  25. ;-----------------------------------------------------------------------------
  26. ; Some paths.
  27. ;-----------------------------------------------------------------------------
  28. !ifndef MING_PATH
  29. !define MING_PATH "/usr/i686-w64-mingw32/sys-root/mingw"
  30. !endif
  31. !define MING_BIN "${MING_PATH}/bin"
  32. !define MING_LIB "${MING_PATH}/lib"
  33. !define MING_SHARE "${MING_PATH}/share"
  34. !define BUILD_PATH "@CMAKE_BINARY_DIR@"
  35. !define SOURCE_PATH "@CMAKE_SOURCE_DIR@"
  36. !define QT_DLL_PATH "${MING_BIN}"
  37. !define ACCESSIBLE_DLL_PATH "${MING_LIB}/qt5/plugins/accessible"
  38. !define SQLITE_DLL_PATH "${MING_LIB}/qt5/plugins/sqldrivers"
  39. !define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt5/plugins/imageformats"
  40. !define PLATFORMS_DLL_PATH "${MING_LIB}/qt5/plugins/platforms"
  41. !define CSYNC_LIBRARY_DIR "@CSYNC_LIBRARY_DIR@"
  42. !define CSYNC_CONFIG_DIR "@CSYNC_CONFIG_DIR@"
  43. !define NSI_PATH "${source_path}/admin/win/nsi"
  44. ;-----------------------------------------------------------------------------
  45. ; Installer version
  46. ;-----------------------------------------------------------------------------
  47. !define VER_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@"
  48. !define VER_MINOR "@CPACK_PACKAGE_VERSION_MINOR@"
  49. !define VER_PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
  50. !define VER_BUILD "@CPACK_PACKAGE_VERSION_BUILD@"
  51. !define VERSION "@CPACK_PACKAGE_VERSION@"
  52. Var InstallRunIfSilent
  53. Var NoAutomaticUpdates
  54. ;-----------------------------------------------------------------------------
  55. ; Installer build timestamp.
  56. ;-----------------------------------------------------------------------------
  57. !define /date BUILD_TIME "built on %Y/%m/%d at %I:%M %p"
  58. ;-----------------------------------------------------------------------------
  59. ; Initial installer setup and definitions.
  60. ;-----------------------------------------------------------------------------
  61. Name "@CPACK_NSIS_PACKAGE_NAME@"
  62. BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
  63. OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
  64. InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
  65. InstallDirRegKey HKCU "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
  66. InstType Standard
  67. InstType Full
  68. InstType Minimal
  69. CRCCheck On
  70. SetCompressor @CPACK_NSIS_COMPRESSOR@
  71. RequestExecutionLevel user ;Now using the UAC plugin.
  72. ReserveFile NSIS.InstallOptions.ini
  73. ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
  74. @CPACK_NSIS_SECTION_SELECTED_VARS@
  75. ;-----------------------------------------------------------------------------
  76. ; Include some required header files.
  77. ;-----------------------------------------------------------------------------
  78. !include LogicLib.nsh ;Used by APPDATA uninstaller.
  79. !include MUI2.nsh ;Used by APPDATA uninstaller.
  80. !include InstallOptions.nsh ;Required by MUI2 to support old MUI_INSTALLOPTIONS.
  81. !include Memento.nsh ;Remember user selections.
  82. !include WinVer.nsh ;Windows version detection.
  83. !include WordFunc.nsh ;Used by VersionCompare macro function.
  84. !include FileFunc.nsh ;Used to read out parameters
  85. !include UAC.nsh ;Used by the UAC elevation to install as user or admin.
  86. !include nsProcess.nsh ;Used to kill the running process
  87. !include Library.nsh ;Used by the COM registration for shell extensions
  88. !include x64.nsh ;Used to determine the right arch for the shell extensions
  89. ;-----------------------------------------------------------------------------
  90. ; Memento selections stored in registry.
  91. ;-----------------------------------------------------------------------------
  92. !define MEMENTO_REGISTRY_ROOT HKLM
  93. !define MEMENTO_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}"
  94. ;-----------------------------------------------------------------------------
  95. ; Modern User Interface (MUI) definitions and setup.
  96. ;-----------------------------------------------------------------------------
  97. !define MUI_ABORTWARNING
  98. !define MUI_ICON ${NSI_PATH}\installer.ico
  99. !define MUI_UNICON ${NSI_PATH}\installer.ico
  100. !define MUI_WELCOMEFINISHPAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/welcome.bmp
  101. !define MUI_HEADERIMAGE
  102. !define MUI_HEADERIMAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/page_header.bmp
  103. !define MUI_COMPONENTSPAGE_SMALLDESC
  104. ; We removed this, h1 issue 191687
  105. ;!define MUI_FINISHPAGE_LINK "${APPLICATION_DOMAIN}"
  106. ;!define MUI_FINISHPAGE_LINK_LOCATION "http://${APPLICATION_DOMAIN}"
  107. !define MUI_FINISHPAGE_NOREBOOTSUPPORT
  108. !ifdef OPTION_FINISHPAGE_RELEASE_NOTES
  109. !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
  110. !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NOTES.txt"
  111. !define MUI_FINISHPAGE_SHOWREADME_TEXT $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING
  112. !endif
  113. !ifdef OPTION_FINISHPAGE_LAUNCHER
  114. !define MUI_FINISHPAGE_NOAUTOCLOSE
  115. !define MUI_FINISHPAGE_RUN
  116. !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchApplication"
  117. !endif
  118. ;-----------------------------------------------------------------------------
  119. ; Page macros.
  120. ;-----------------------------------------------------------------------------
  121. !insertmacro MUI_PAGE_WELCOME
  122. !ifdef OPTION_LICENSE_AGREEMENT
  123. !insertmacro MUI_PAGE_LICENSE "${APPLICATION_LICENSE}"
  124. !endif
  125. Page custom PageReinstall PageLeaveReinstall
  126. !insertmacro MUI_PAGE_COMPONENTS
  127. !insertmacro MUI_PAGE_DIRECTORY
  128. !insertmacro MUI_PAGE_INSTFILES
  129. !ifdef OPTION_FINISHPAGE
  130. !insertmacro MUI_PAGE_FINISH
  131. !endif
  132. !insertmacro MUI_UNPAGE_CONFIRM
  133. !insertmacro MUI_UNPAGE_INSTFILES
  134. ;-----------------------------------------------------------------------------
  135. ; Other MUI macros.
  136. ;-----------------------------------------------------------------------------
  137. !insertmacro MUI_LANGUAGE "English"
  138. !include ${source_path}/admin/win/nsi/l10n/languages.nsh
  139. !include ${source_path}/admin/win/nsi/l10n/declarations.nsh
  140. ; Set version strings with english locale
  141. VIProductVersion "${VERSION}"
  142. VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APPLICATION_NAME}"
  143. VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${APPLICATION_VENDOR}"
  144. VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VERSION}"
  145. !macro SETLANG un
  146. Function ${un}SetLang
  147. # load the selected language file
  148. !include "${source_path}/admin/win/nsi/l10n\English.nsh"
  149. StrCmp $LANGUAGE ${LANG_GERMAN} German 0
  150. StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
  151. StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
  152. StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
  153. StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
  154. StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
  155. StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
  156. StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
  157. StrCmp $LANGUAGE ${LANG_GREEK} Greek 0
  158. StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
  159. StrCmp $LANGUAGE ${LANG_GALICIAN} Galician 0
  160. StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
  161. StrCmp $LANGUAGE ${LANG_TURKISH} Turkish 0
  162. StrCmp $LANGUAGE ${LANG_NORWEGIAN} Norwegian 0
  163. StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
  164. German:
  165. !include "${source_path}/admin/win/nsi/l10n\German.nsh"
  166. Goto EndLanguageCmp
  167. Dutch:
  168. !include "${source_path}/admin/win/nsi/l10n\Dutch.nsh"
  169. Goto EndLanguageCmp
  170. Finnish:
  171. !include "${source_path}/admin/win/nsi/l10n\Finnish.nsh"
  172. Goto EndLanguageCmp
  173. Japanese:
  174. !include "${source_path}/admin/win/nsi/l10n\Japanese.nsh"
  175. Goto EndLanguageCmp
  176. Slovenian:
  177. !include "${source_path}/admin/win/nsi/l10n\Slovenian.nsh"
  178. Goto EndLanguageCmp
  179. Spanish:
  180. !include "${source_path}/admin/win/nsi/l10n\Spanish.nsh"
  181. Goto EndLanguageCmp
  182. Italian:
  183. !include "${source_path}/admin/win/nsi/l10n\Italian.nsh"
  184. Goto EndLanguageCmp
  185. Estonian:
  186. !include "${source_path}/admin/win/nsi/l10n\Estonian.nsh"
  187. Goto EndLanguageCmp
  188. Greek:
  189. !include "${source_path}/admin/win/nsi/l10n\Greek.nsh"
  190. Goto EndLanguageCmp
  191. Basque:
  192. !include "${source_path}/admin/win/nsi/l10n\Basque.nsh"
  193. Goto EndLanguageCmp
  194. Galician:
  195. !include "${source_path}/admin/win/nsi/l10n\Galician.nsh"
  196. Goto EndLanguageCmp
  197. Polish:
  198. !include "${source_path}/admin/win/nsi/l10n\Polish.nsh"
  199. Goto EndLanguageCmp
  200. Turkish:
  201. !include "${source_path}/admin/win/nsi/l10n\Turkish.nsh"
  202. Goto EndLanguageCmp
  203. Brazilian:
  204. !include "${source_path}/admin/win/nsi/l10n\PortugueseBR.nsh"
  205. Goto EndLanguageCmp
  206. Norwegian:
  207. !include "${source_path}/admin/win/nsi/l10n\Norwegian.nsh"
  208. EndLanguageCmp:
  209. FunctionEnd
  210. !macroend
  211. !insertmacro SETLANG ""
  212. !insertmacro SETLANG "un."
  213. ; Usage: ${If} ${HasSection} SectionName
  214. !macro _HasSection _a _b _t _f
  215. ReadRegDWORD $_LOGICLIB_TEMP "${MEMENTO_REGISTRY_ROOT}" "${MEMENTO_REGISTRY_KEY}" "MementoSection_${_b}"
  216. IntCmpU $_LOGICLIB_TEMP 0 ${_f} ${_t}
  217. !macroend
  218. !define HasSection `"" HasSection`
  219. ##############################################################################
  220. # #
  221. # FINISH PAGE LAUNCHER FUNCTIONS #
  222. # #
  223. ##############################################################################
  224. Function LaunchApplication
  225. !insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\${APPLICATION_EXECUTABLE}" "" "" ""
  226. FunctionEnd
  227. ##############################################################################
  228. # #
  229. # PROCESS HANDLING FUNCTIONS AND MACROS #
  230. # #
  231. ##############################################################################
  232. !macro CheckForProcess processName gotoWhenFound gotoWhenNotFound
  233. ${nsProcess::FindProcess} ${processName} $R0
  234. StrCmp $R0 0 ${gotoWhenFound} ${gotoWhenNotFound}
  235. !macroend
  236. !macro ConfirmEndProcess processName
  237. MessageBox MB_YESNO|MB_ICONEXCLAMATION \
  238. $ConfirmEndProcess_MESSAGEBOX_TEXT \
  239. /SD IDYES IDYES process_${processName}_kill IDNO process_${processName}_ended
  240. process_${processName}_kill:
  241. DetailPrint $ConfirmEndProcess_KILLING_PROCESSES_TEXT
  242. ${nsProcess::KillProcess} ${processName} $R0
  243. Sleep 1500
  244. StrCmp $R0 "1" process_${processName}_ended
  245. DetailPrint $ConfirmEndProcess_KILL_NOT_FOUND_TEXT
  246. process_${processName}_ended:
  247. !macroend
  248. !macro CheckAndConfirmEndProcess processName
  249. !insertmacro CheckForProcess ${processName} 0 no_process_${processName}_to_end
  250. !insertmacro ConfirmEndProcess ${processName}
  251. no_process_${processName}_to_end:
  252. !macroend
  253. Function EnsureOwncloudShutdown
  254. !insertmacro CheckAndConfirmEndProcess "${APPLICATION_EXECUTABLE}"
  255. FunctionEnd
  256. Function InstallRedistributables
  257. ${If} ${RunningX64}
  258. ExecWait '"$OUTDIR\vcredist_x64.exe" /install /quiet'
  259. ${Else}
  260. ExecWait '"$OUTDIR\vcredist_x86.exe" /install /quiet'
  261. ${EndIf}
  262. Delete "$OUTDIR\vcredist_x86.exe"
  263. Delete "$OUTDIR\vcredist_x64.exe"
  264. FunctionEnd
  265. ##############################################################################
  266. # #
  267. # RE-INSTALLER FUNCTIONS #
  268. # #
  269. ##############################################################################
  270. Function PageReinstall
  271. ReadRegStr $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
  272. StrCmp $R0 "" 0 +2
  273. Abort
  274. ;Detect version
  275. ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor"
  276. IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
  277. minor_check:
  278. ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor"
  279. IntCmp $R0 ${VER_MINOR} rev_check new_version older_version
  280. rev_check:
  281. ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision"
  282. IntCmp $R0 ${VER_PATCH} build_check new_version older_version
  283. build_check:
  284. ReadRegDWORD $R0 HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild"
  285. IntCmp $R0 ${VER_BUILD} same_version new_version older_version
  286. new_version:
  287. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $PageReinstall_NEW_Field_1
  288. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_NEW_Field_2
  289. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_NEW_Field_3
  290. !insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE
  291. StrCpy $R0 "1"
  292. Goto reinst_start
  293. older_version:
  294. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $PageReinstall_OLD_Field_1
  295. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_NEW_Field_2
  296. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_NEW_Field_3
  297. !insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE
  298. StrCpy $R0 "1"
  299. Goto reinst_start
  300. same_version:
  301. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" $PageReinstall_SAME_Field_1
  302. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" $PageReinstall_SAME_Field_2
  303. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" $PageReinstall_SAME_Field_3
  304. !insertmacro MUI_HEADER_TEXT $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE
  305. StrCpy $R0 "2"
  306. reinst_start:
  307. !insertmacro INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
  308. FunctionEnd
  309. Function PageLeaveReinstall
  310. !insertmacro INSTALLOPTIONS_READ $R1 "NSIS.InstallOptions.ini" "Field 2" "State"
  311. StrCmp $R0 "1" 0 +2
  312. StrCmp $R1 "1" reinst_uninstall reinst_done
  313. StrCmp $R0 "2" 0 +3
  314. StrCmp $R1 "1" reinst_done reinst_uninstall
  315. reinst_uninstall:
  316. ReadRegStr $R1 ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "UninstallString"
  317. HideWindow
  318. ClearErrors
  319. ExecWait '$R1 _?=$INSTDIR'
  320. IfErrors no_remove_uninstaller
  321. IfFileExists "$INSTDIR\${APPLICATION_EXECUTABLE}" no_remove_uninstaller
  322. Delete $R1
  323. RMDir $INSTDIR
  324. no_remove_uninstaller:
  325. StrCmp $R0 "2" 0 +3
  326. Quit
  327. BringToFront
  328. reinst_done:
  329. FunctionEnd
  330. ##############################################################################
  331. # #
  332. # INSTALLER SECTIONS #
  333. # #
  334. ##############################################################################
  335. Section "${APPLICATION_NAME}" SEC_APPLICATION
  336. SectionIn 1 2 3 RO
  337. SetDetailsPrint listonly
  338. SetDetailsPrint textonly
  339. DetailPrint $SEC_APPLICATION_DETAILS
  340. SetDetailsPrint listonly
  341. SetOutPath "$INSTDIR"
  342. ;Main executable & csync
  343. File "${BUILD_PATH}\bin\${APPLICATION_EXECUTABLE}"
  344. File "${BUILD_PATH}\bin\${APPLICATION_CMD_EXECUTABLE}"
  345. File "${BUILD_PATH}\bin\lib${APPLICATION_SHORTNAME}sync.dll"
  346. File "${BUILD_PATH}\bin\libocsync.dll"
  347. File "${BUILD_PATH}\src\gui\client*.qm"
  348. ; Make sure only to copy qt, not qt_help, etc
  349. File "${MING_SHARE}\qt5\translations\qt_??.qm"
  350. File "${MING_SHARE}\qt5\translations\qt_??_??.qm"
  351. File "${MING_SHARE}\qt5\translations\qtbase_*.qm"
  352. File "${MING_SHARE}\qt5\translations\qtkeychain_*.qm"
  353. ;Add crash reporter if it was built
  354. File /nonfatal "${BUILD_PATH}/bin/${CRASHREPORTER_EXECUTABLE}.exe"
  355. SetOutPath "$INSTDIR\platforms"
  356. File "${PLATFORMS_DLL_PATH}\qwindows.dll"
  357. SetOutPath "$INSTDIR\imageformats"
  358. File "${IMAGEFORMATS_DLL_PATH}\qgif.dll"
  359. File "${IMAGEFORMATS_DLL_PATH}\qjpeg.dll"
  360. File "${IMAGEFORMATS_DLL_PATH}\qico.dll"
  361. File "${IMAGEFORMATS_DLL_PATH}\qsvg.dll"
  362. ; PNG is built in Qt
  363. SetOutPath "$INSTDIR\sqldrivers"
  364. File "${SQLITE_DLL_PATH}\qsqlite.dll"
  365. SetOutPath "$INSTDIR"
  366. ;License & release notes.
  367. File "@CPACK_RESOURCE_FILE_LICENSE@"
  368. ;File /oname=NOTES.txt ${NSI_PATH}\RELEASE_NOTES.txt
  369. ;Qt config:
  370. File "${NSI_PATH}\qt.conf"
  371. ;Qt stuff:
  372. File "${QT_DLL_PATH}\Qt5Core.dll"
  373. File "${QT_DLL_PATH}\Qt5Gui.dll"
  374. File "${QT_DLL_PATH}\Qt5Network.dll"
  375. File "${QT_DLL_PATH}\Qt5PrintSupport.dll"
  376. File "${QT_DLL_PATH}\Qt5Svg.dll"
  377. File "${QT_DLL_PATH}\Qt5Qml.dll"
  378. File "${QT_DLL_PATH}\Qt5Sql.dll"
  379. File "${QT_DLL_PATH}\Qt5WebKit.dll"
  380. File "${QT_DLL_PATH}\Qt5WebKitWidgets.dll"
  381. File "${QT_DLL_PATH}\Qt5Widgets.dll"
  382. File "${QT_DLL_PATH}\Qt5Xml.dll"
  383. ;QtWebKit dependencies
  384. File "${QT_DLL_PATH}\Qt5Multimedia.dll"
  385. File "${QT_DLL_PATH}\Qt5MultimediaWidgets.dll"
  386. File "${QT_DLL_PATH}\Qt5Sensors.dll"
  387. ;Qt deps
  388. File "${MING_BIN}\libpng16-16.dll"
  389. File "${MING_BIN}\icudata56.dll"
  390. File "${MING_BIN}\icui18n56.dll"
  391. File "${MING_BIN}\icuuc56.dll"
  392. File "${MING_BIN}\libEGL.dll"
  393. File "${MING_BIN}\libGLESv2.dll"
  394. File "${MING_BIN}\libjpeg-8.dll"
  395. File "${MING_BIN}\libpcre16-0.dll"
  396. File "${MING_BIN}\libsqlite3-0.dll"
  397. File "${MING_BIN}\libcrypto-10.dll"
  398. File "${MING_BIN}\libssl-10.dll"
  399. File "${MING_BIN}\libstdc++-6.dll"
  400. File "${MING_BIN}\libwebp-5.dll"
  401. File "${MING_BIN}\libxslt-1.dll"
  402. File "${MING_BIN}\libxml2-2.dll"
  403. File "${MING_BIN}\zlib1.dll"
  404. File "${MING_BIN}\libharfbuzz-0.dll"
  405. File "${MING_BIN}\libfreetype-6.dll"
  406. File "${MING_BIN}\libglib-2.0-0.dll"
  407. File "${MING_BIN}\libintl-8.dll"
  408. ;QtKeyChain stuff
  409. File "${MING_BIN}\libqt5keychain.dll"
  410. ;MinGW stuff
  411. File "${MING_BIN}\libgcc_s_sjlj-1.dll"
  412. File "${MING_BIN}\libstdc++-6.dll"
  413. File "${MING_BIN}\libwinpthread-1.dll"
  414. File "${MING_BIN}\libssp-0.dll"
  415. ;CSync configs
  416. File "${SOURCE_PATH}/sync-exclude.lst"
  417. SectionEnd
  418. !ifdef OPTION_SECTION_SC_SHELL_EXT
  419. ${MementoSection} $OPTION_SECTION_SC_SHELL_EXT_SECTION SEC_SHELL_EXT
  420. SectionIn 1 2
  421. SetDetailsPrint textonly
  422. DetailPrint $OPTION_SECTION_SC_SHELL_EXT_DetailPrint
  423. File "${BUILD_PATH}\vcredist_x86.exe"
  424. File "${BUILD_PATH}\vcredist_x64.exe"
  425. Call InstallRedistributables
  426. CreateDirectory "$INSTDIR\shellext"
  427. !define LIBRARY_COM
  428. !define LIBRARY_SHELL_EXTENSION
  429. !define LIBRARY_IGNORE_VERSION
  430. ${If} ${RunningX64}
  431. !define LIBRARY_X64
  432. !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "${SOURCE_PATH}\binary\shell_integration\windows\Release\x64\OCUtil_x64.dll" "$INSTDIR\shellext\OCUtil_x64.dll" "$INSTDIR\shellext"
  433. !insertmacro InstallLib REGDLL NOTSHARED REBOOT_PROTECTED "${SOURCE_PATH}\binary\shell_integration\windows\Release\x64\OCOverlays_x64.dll" "$INSTDIR\shellext\OCOverlays_x64.dll" "$INSTDIR\shellext"
  434. !insertmacro InstallLib REGDLL NOTSHARED REBOOT_PROTECTED "${SOURCE_PATH}\binary\shell_integration\windows\Release\x64\OCContextMenu_x64.dll" "$INSTDIR\shellext\OCContextMenu_x64.dll" "$INSTDIR\shellext"
  435. !undef LIBRARY_X64
  436. ${Else}
  437. !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "${SOURCE_PATH}\binary\shell_integration\windows\Release\Win32\OCUtil_x86.dll" "$INSTDIR\shellext\OCUtil_x86.dll" "$INSTDIR\shellext"
  438. !insertmacro InstallLib REGDLL NOTSHARED REBOOT_PROTECTED "${SOURCE_PATH}\binary\shell_integration\windows\Release\Win32\OCOverlays_x86.dll" "$INSTDIR\shellext\OCOverlays_x86.dll" "$INSTDIR\shellext"
  439. !insertmacro InstallLib REGDLL NOTSHARED REBOOT_PROTECTED "${SOURCE_PATH}\binary\shell_integration\windows\Release\Win32\OCContextMenu_x86.dll" "$INSTDIR\shellext\OCContextMenu_x86.dll" "$INSTDIR\shellext"
  440. ${Endif}
  441. !undef LIBRARY_COM
  442. !undef LIBRARY_SHELL_EXTENSION
  443. !undef LIBRARY_IGNORE_VERSION
  444. ${MementoSectionEnd}
  445. !endif
  446. SectionGroup $SectionGroup_Shortcuts
  447. !ifdef OPTION_SECTION_SC_START_MENU
  448. ${MementoSection} $OPTION_SECTION_SC_START_MENU_SECTION SEC_START_MENU
  449. SectionIn 1 2 3
  450. SetDetailsPrint textonly
  451. DetailPrint $OPTION_SECTION_SC_START_MENU_DetailPrint
  452. SetDetailsPrint listonly
  453. SetShellVarContext all
  454. CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
  455. SetShellVarContext current
  456. ${MementoSectionEnd}
  457. !endif
  458. !ifdef OPTION_SECTION_SC_DESKTOP
  459. ${MementoSection} $OPTION_SECTION_SC_DESKTOP_SECTION SEC_DESKTOP
  460. SectionIn 1 2
  461. SetDetailsPrint textonly
  462. DetailPrint $OPTION_SECTION_SC_DESKTOP_DetailPrint
  463. SetDetailsPrint listonly
  464. SetShellVarContext all
  465. CreateShortCut "$DESKTOP\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
  466. SetShellVarContext current
  467. ${MementoSectionEnd}
  468. !endif
  469. !ifdef OPTION_SECTION_SC_QUICK_LAUNCH
  470. ${MementoSection} $OPTION_SECTION_SC_QUICK_LAUNCH_SECTION SEC_QUICK_LAUNCH
  471. SectionIn 1 2
  472. SetDetailsPrint textonly
  473. DetailPrint $OPTION_SECTION_SC_QUICK_LAUNCH_DetailPrint
  474. SetShellVarContext all
  475. SetDetailsPrint listonly
  476. CreateShortCut "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
  477. SetShellVarContext current
  478. ${MementoSectionEnd}
  479. !endif
  480. SectionGroupEnd
  481. ${MementoSectionDone}
  482. ; Installer section descriptions
  483. ;--------------------------------
  484. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  485. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_APPLICATION} $OPTION_SECTION_SC_APPLICATION_Desc
  486. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_START_MENU} $OPTION_SECTION_SC_START_MENU_Desc
  487. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $OPTION_SECTION_SC_DESKTOP_Desc
  488. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_LAUNCH} $OPTION_SECTION_SC_QUICK_LAUNCH_Desc
  489. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  490. Section -post
  491. ;Uninstaller file.
  492. SetDetailsPrint textonly
  493. DetailPrint $UNINSTALLER_FILE_Detail
  494. SetDetailsPrint listonly
  495. WriteUninstaller $INSTDIR\uninstall.exe
  496. ;Registry keys required for installer version handling and uninstaller.
  497. SetDetailsPrint textonly
  498. DetailPrint $UNINSTALLER_REGISTRY_Detail
  499. SetDetailsPrint listonly
  500. ;Version numbers used to detect existing installation version for comparison.
  501. WriteRegStr HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "" $INSTDIR
  502. WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
  503. WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
  504. WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
  505. WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
  506. ;Add or Remove Programs entry.
  507. WriteRegExpandStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  508. WriteRegExpandStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "InstallLocation" "$INSTDIR"
  509. WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayName" "${APPLICATION_NAME}"
  510. WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "Publisher" "${APPLICATION_VENDOR}"
  511. WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"
  512. WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
  513. WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "VersionMajor" "${VER_MAJOR}"
  514. WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "VersionMinor" "${VER_MINOR}.${VER_PATCH}.${VER_BUILD}"
  515. WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "URLInfoAbout" "http://${APPLICATION_DOMAIN}/"
  516. WriteRegStr ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "HelpLink" "http://${APPLICATION_DOMAIN}/"
  517. WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "NoModify" "1"
  518. WriteRegDWORD ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "NoRepair" "1"
  519. SetDetailsPrint textonly
  520. DetailPrint $UNINSTALLER_FINISHED_Detail
  521. SectionEnd
  522. ##############################################################################
  523. # #
  524. # UNINSTALLER SECTION #
  525. # #
  526. ##############################################################################
  527. Function un.EnsureOwncloudShutdown
  528. !insertmacro CheckAndConfirmEndProcess "${APPLICATION_EXECUTABLE}"
  529. FunctionEnd
  530. Section Uninstall
  531. IfFileExists "$INSTDIR\${APPLICATION_EXECUTABLE}" owncloud_installed
  532. MessageBox MB_YESNO $UNINSTALL_MESSAGEBOX /SD IDYES IDYES owncloud_installed
  533. Abort $UNINSTALL_ABORT
  534. owncloud_installed:
  535. ; Delete Navigation Pane entries added for Windows 10.
  536. ; On 64bit Windows, the client will be writing to the 64bit registry.
  537. ${If} ${RunningX64}
  538. SetRegView 64
  539. ${EndIf}
  540. StrCpy $0 0
  541. loop:
  542. ; Look at every registered explorer namespace for HKCU and check if it was added by our application
  543. ; (we write to a custom "ApplicationName" value there).
  544. EnumRegKey $1 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace" $0
  545. StrCmp $1 "" done
  546. ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\$1" "ApplicationName"
  547. StrCmp $R0 "${APPLICATION_NAME}" deleteClsid
  548. ; Increment the index when not deleting the enumerated key.
  549. IntOp $0 $0 + 1
  550. goto loop
  551. deleteClsid:
  552. DetailPrint "Removing Navigation Pane CLSID $1"
  553. ; Should match FolderMan::updateCloudStorageRegistry
  554. DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\$1"
  555. DeleteRegKey HKCU "Software\Classes\CLSID\$1"
  556. DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" $1
  557. goto loop
  558. done:
  559. ; Go back to the 32bit registry.
  560. SetRegView lastused
  561. ;Delete registry keys.
  562. DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionBuild"
  563. DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMajor"
  564. DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionMinor"
  565. DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "VersionRevision"
  566. DeleteRegValue HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" ""
  567. DeleteRegKey HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}"
  568. DeleteRegKey HKCR "${APPLICATION_NAME}"
  569. ;Shell extension
  570. !ifdef OPTION_SECTION_SC_SHELL_EXT
  571. !define LIBRARY_COM
  572. !define LIBRARY_SHELL_EXTENSION
  573. !define LIBRARY_IGNORE_VERSION
  574. ${If} ${HasSection} SEC_SHELL_EXT
  575. DetailPrint "Uninstalling x64 overlay DLLs"
  576. !define LIBRARY_X64
  577. !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCContextMenu_x64.dll"
  578. !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCOverlays_x64.dll"
  579. !insertmacro UnInstallLib DLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCUtil_x64.dll"
  580. !undef LIBRARY_X64
  581. DetailPrint "Uninstalling x86 overlay DLLs"
  582. !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCContextMenu_x86.dll"
  583. !insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCOverlays_x86.dll"
  584. !insertmacro UnInstallLib DLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCUtil_x86.dll"
  585. ${EndIf}
  586. !undef LIBRARY_COM
  587. !undef LIBRARY_SHELL_EXTENSION
  588. !undef LIBRARY_IGNORE_VERSION
  589. !endif
  590. ;Start menu shortcut
  591. !ifdef OPTION_SECTION_SC_START_MENU
  592. SetShellVarContext all
  593. ${If} ${HasSection} SEC_START_MENU
  594. Delete "$SMPROGRAMS\${APPLICATION_NAME}.lnk"
  595. ${EndIf}
  596. SetShellVarContext current
  597. !endif
  598. ;Desktop shortcut.
  599. !ifdef OPTION_SECTION_SC_DESKTOP
  600. ${If} ${HasSection} SEC_DESKTOP
  601. SetShellVarContext all
  602. ${If} ${FileExists} "$DESKTOP\${APPLICATION_NAME}.lnk"
  603. Delete "$DESKTOP\${APPLICATION_NAME}.lnk"
  604. ${EndIf}
  605. SetShellVarContext current
  606. ${EndIf}
  607. !endif
  608. ;Quick Launch shortcut.
  609. !ifdef OPTION_SECTION_SC_QUICK_LAUNCH
  610. ${If} ${HasSection} SEC_QUICK_LAUNCH
  611. SetShellVarContext all
  612. ${If} ${FileExists} "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
  613. Delete "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
  614. ${EndIf}
  615. SetShellVarContext current
  616. ${EndIf}
  617. !endif
  618. ;Remove all the Program Files.
  619. RMDir /r $INSTDIR
  620. DeleteRegKey ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}"
  621. SetDetailsPrint textonly
  622. DetailPrint $UNINSTALLER_FINISHED_Detail
  623. SectionEnd
  624. ##############################################################################
  625. # #
  626. # NSIS Installer Event Handler Functions #
  627. # #
  628. ##############################################################################
  629. Function .onInit
  630. SetOutPath $INSTDIR
  631. ${GetParameters} $R0
  632. ${GetOptions} $R0 "/launch" $R0
  633. ${IfNot} ${Errors}
  634. StrCpy $InstallRunIfSilent "yes"
  635. ${EndIf}
  636. ${GetParameters} $R0
  637. ${GetOptions} $R0 "/noautoupdate" $R0
  638. ${IfNot} ${Errors}
  639. StrCpy $NoAutomaticUpdates "yes"
  640. ${EndIf}
  641. !insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
  642. ; uncomment this line if you want to see the language selection
  643. ;!insertmacro MUI_LANGDLL_DISPLAY
  644. Call SetLang
  645. ; Remove Quick Launch option from Windows 7, as no longer applicable - usually.
  646. ${IfNot} ${AtMostWinVista}
  647. SectionSetText ${SEC_QUICK_LAUNCH} $INIT_NO_QUICK_LAUNCH
  648. SectionSetFlags ${SEC_QUICK_LAUNCH} ${SF_RO}
  649. SectionSetInstTypes ${SEC_QUICK_LAUNCH} 0
  650. ${EndIf}
  651. ; Some people might have a shortcut called 'ownCloud' pointing elsewhere, see #356
  652. ; Unselect item and adjust text
  653. ${If} ${FileExists} "$DESKTOP\${APPLICATION_NAME}.lnk"
  654. SectionSetText ${SEC_DESKTOP} $INIT_NO_DESKTOP
  655. Push $0
  656. SectionSetFlags ${SEC_DESKTOP} 0
  657. SectionSetInstTypes ${SEC_DESKTOP} 0
  658. Pop $0
  659. ${EndIf}
  660. ${MementoSectionRestore}
  661. UAC_TryAgain:
  662. !insertmacro UAC_RunElevated
  663. ${Switch} $0
  664. ${Case} 0
  665. ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
  666. ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
  667. ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
  668. MessageBox mb_YesNo|mb_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND $UAC_INSTALLER_REQUIRE_ADMIN /SD IDNO IDYES UAC_TryAgain IDNO 0
  669. ${EndIf}
  670. ;fall-through and die
  671. ${Case} 1223
  672. MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_INSTALLER_REQUIRE_ADMIN
  673. Quit
  674. ${Case} 1062
  675. MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_ERROR_LOGON_SERVICE
  676. Quit
  677. ${Default}
  678. MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
  679. Abort
  680. Quit
  681. ${EndSwitch}
  682. ;Prevent multiple instances.
  683. System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${APPLICATION_SHORTNAME}Installer") i .r1 ?e'
  684. Pop $R0
  685. StrCmp $R0 0 +3
  686. MessageBox MB_OK|MB_ICONEXCLAMATION $INIT_INSTALLER_RUNNING
  687. Abort
  688. ;Use available InstallLocation when possible. This is useful in the uninstaller
  689. ;via re-install, which would otherwise use a default location - a bug.
  690. ReadRegStr $R0 ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "InstallLocation"
  691. StrCmp $R0 "" SkipSetInstDir
  692. StrCpy $INSTDIR $R0
  693. SkipSetInstDir:
  694. ;Shutdown ${APPLICATION_NAME} in case Add/Remove re-installer option used.
  695. Call EnsureOwncloudShutdown
  696. ReadRegStr $R0 ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "InstallLocation"
  697. ${If} ${Silent}
  698. ${AndIf} $R0 != ""
  699. ExecWait '"$R0\Uninstall.exe" /S _?=$R0'
  700. ${EndIf}
  701. FunctionEnd
  702. Function .onInstSuccess
  703. ${MementoSectionSave}
  704. ${If} $NoAutomaticUpdates == "yes"
  705. WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "skipUpdateCheck" "1"
  706. ${EndIf}
  707. ; TODO: Only needed to when updating from 2.1.{0,1}. Remove in due time.
  708. Delete /REBOOTOK $INSTDIR\bearer\qgenericbearer.dll
  709. Delete /REBOOTOK $INSTDIR\bearer\qnativewifibearer.dll
  710. RMDir /REBOOTOK $INSTDIR\bearer
  711. ${If} ${Silent}
  712. ${AndIf} $InstallRunIfSilent == "yes"
  713. Call LaunchApplication
  714. ${EndIf}
  715. FunctionEnd
  716. Function .onInstFailed
  717. FunctionEnd
  718. ##############################################################################
  719. # #
  720. # NSIS Uninstaller Event Handler Functions #
  721. # #
  722. ##############################################################################
  723. Function un.onInit
  724. Call un.SetLang
  725. UAC_TryAgain:
  726. !insertmacro UAC_RunElevated
  727. ${Switch} $0
  728. ${Case} 0
  729. ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
  730. ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
  731. ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
  732. MessageBox mb_YesNo|mb_ICONEXCLAMATION|MB_TOPMOST|MB_SETFOREGROUND $UAC_UNINSTALLER_REQUIRE_ADMIN /SD IDNO IDYES UAC_TryAgain IDNO 0
  733. ${EndIf}
  734. ;fall-through and die
  735. ${Case} 1223
  736. MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_UNINSTALLER_REQUIRE_ADMIN
  737. Quit
  738. ${Case} 1062
  739. MessageBox MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND $UAC_ERROR_LOGON_SERVICE
  740. Quit
  741. ${Default}
  742. MessageBox MB_ICONSTOP "$UAC_ERROR_ELEVATE $0"
  743. Abort
  744. Quit
  745. ${EndSwitch}
  746. ;Prevent multiple instances.
  747. System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${APPLICATION_SHORTNAME}Uninstaller") i .r1 ?e'
  748. Pop $R0
  749. StrCmp $R0 0 +3
  750. MessageBox MB_OK|MB_ICONEXCLAMATION $INIT_UNINSTALLER_RUNNING
  751. Abort
  752. ;Shutdown ${APPLICATION_NAME} in order to remove locked files.
  753. Call un.EnsureOwncloudShutdown
  754. FunctionEnd
  755. Function un.onUnInstSuccess
  756. FunctionEnd
  757. Function un.onUnInstFailed
  758. FunctionEnd