jellyfin.nsi 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. ; Shows a lot of debug information while compiling
  2. ; This can be removed once stable.
  3. !verbose 4
  4. SetCompressor lzma
  5. ShowInstDetails show
  6. ShowUninstDetails show
  7. ;--------------------------------
  8. !define SF_USELECTED 0 ; used to check selected options status, rest are inherited from Sections.nsh
  9. !include "MUI2.nsh"
  10. !include "Sections.nsh"
  11. !include "LogicLib.nsh"
  12. !include "helpers\ShowError.nsh"
  13. ; Global variables that we'll use
  14. Var _JELLYFINVERSION_
  15. Var _JELLYFINDATADIR_
  16. Var _SETUPTYPE_
  17. Var _INSTALLSERVICE_
  18. Var _SERVICESTART_
  19. Var _SERVICEACCOUNTTYPE_
  20. Var _EXISTINGINSTALLATION_
  21. Var _EXISTINGSERVICE_
  22. ;
  23. !ifdef x64
  24. !define ARCH "x64"
  25. !define NAMESUFFIX "(64 bit)"
  26. !define INSTALL_DIRECTORY "$PROGRAMFILES64\Jellyfin\Server"
  27. !endif
  28. !ifdef x84
  29. !define ARCH "x86"
  30. !define NAMESUFFIX "(32 bit)"
  31. !define INSTALL_DIRECTORY "$PROGRAMFILES32\Jellyfin\Server"
  32. !endif
  33. !ifndef ARCH
  34. !error "Set the Arch with /Dx86 or /Dx64"
  35. !endif
  36. ;--------------------------------
  37. !define REG_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\JellyfinServer" ;Registry to show up in Add/Remove Programs
  38. !define REG_CONFIG_KEY "Software\Jellyfin\Server" ;Registry to store all configuration
  39. !getdllversion "$%InstallLocation%\jellyfin.dll" ver_ ;Align installer version with jellyfin.dll version
  40. Name "Jellyfin Server ${ver_1}.${ver_2}.${ver_3} ${NAMESUFFIX}" ; This is referred in various header text labels
  41. OutFile "jellyfin_${ver_1}.${ver_2}.${ver_3}_windows-${ARCH}.exe" ; Naming convention jellyfin_{version}_windows-{arch].exe
  42. BrandingText "Jellyfin Server ${ver_1}.${ver_2}.${ver_3} Installer" ; This shows in just over the buttons
  43. ; installer attributes, these show up in details tab on installer properties
  44. VIProductVersion "${ver_1}.${ver_2}.${ver_3}.0" ; VIProductVersion format, should be X.X.X.X
  45. VIFileVersion "${ver_1}.${ver_2}.${ver_3}.0" ; VIFileVersion format, should be X.X.X.X
  46. VIAddVersionKey "ProductName" "Jellyfin Server"
  47. VIAddVersionKey "FileVersion" "${ver_1}.${ver_2}.${ver_3}.0"
  48. VIAddVersionKey "LegalCopyright" "(c) 2019 Jellyfin Contributors. Code released under the GNU General Public License"
  49. VIAddVersionKey "FileDescription" "Jellyfin Server: The Free Software Media System"
  50. ;TODO, check defaults
  51. InstallDir ${INSTALL_DIRECTORY} ;Default installation folder
  52. InstallDirRegKey HKLM "${REG_CONFIG_KEY}" "InstallFolder" ;Read the registry for install folder,
  53. RequestExecutionLevel admin ; ask it upfront for service control, and installing in priv folders
  54. CRCCheck on ; make sure the installer wasn't corrupted while downloading
  55. !define MUI_ABORTWARNING ;Prompts user in case of aborting install
  56. ; TODO: Replace with nice Jellyfin Icons
  57. !ifdef UXPATH
  58. !define MUI_ICON "${UXPATH}\branding\NSIS\modern-install.ico" ; Installer Icon
  59. !define MUI_UNICON "${UXPATH}\branding\NSIS\modern-uninstall.ico" ; Uninstaller Icon
  60. !define MUI_HEADERIMAGE
  61. !define MUI_HEADERIMAGE_BITMAP "${UXPATH}\branding\NSIS\installer-header.bmp"
  62. !define MUI_WELCOMEFINISHPAGE_BITMAP "${UXPATH}\branding\NSIS\installer-right.bmp"
  63. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${UXPATH}\branding\NSIS\installer-right.bmp"
  64. !endif
  65. ;--------------------------------
  66. ;Pages
  67. ; Welcome Page
  68. !define MUI_WELCOMEPAGE_TEXT "The installer will ask for details to install Jellyfin Server."
  69. !insertmacro MUI_PAGE_WELCOME
  70. ; License Page
  71. !insertmacro MUI_PAGE_LICENSE "$%InstallLocation%\LICENSE" ; picking up generic GPL
  72. ; Setup Type Page
  73. Page custom ShowSetupTypePage SetupTypePage_Config
  74. ; Components Page
  75. !insertmacro MUI_PAGE_COMPONENTS
  76. !define MUI_PAGE_CUSTOMFUNCTION_PRE HideInstallDirectoryPage ; Controls when to hide / show
  77. !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Install folder" ; shows just above the folder selection dialog
  78. !insertmacro MUI_PAGE_DIRECTORY
  79. ; Data folder Page
  80. !define MUI_PAGE_CUSTOMFUNCTION_PRE HideDataDirectoryPage ; Controls when to hide / show
  81. !define MUI_PAGE_HEADER_TEXT "Choose Data Location"
  82. !define MUI_PAGE_HEADER_SUBTEXT "Choose the folder in which to install the Jellyfin Server data."
  83. !define MUI_DIRECTORYPAGE_TEXT_TOP "The installer will set the following folder for Jellyfin Server data. To install in a different folder, click Browse and select another folder. Please make sure the folder exists and is accessible. Click Next to continue."
  84. !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data folder"
  85. !define MUI_DIRECTORYPAGE_VARIABLE $_JELLYFINDATADIR_
  86. !insertmacro MUI_PAGE_DIRECTORY
  87. ; Custom Dialogs
  88. !include "dialogs\setuptype.nsdinc"
  89. !include "dialogs\service-config.nsdinc"
  90. !include "dialogs\confirmation.nsdinc"
  91. ; Select service account type
  92. #!define MUI_PAGE_CUSTOMFUNCTION_PRE HideServiceConfigPage ; Controls when to hide / show (This does not work for Page, might need to go PageEx)
  93. #!define MUI_PAGE_CUSTOMFUNCTION_SHOW fnc_service_config_Show
  94. #!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ServiceConfigPage_Config
  95. #!insertmacro MUI_PAGE_CUSTOM ServiceAccountType
  96. Page custom ShowServiceConfigPage ServiceConfigPage_Config
  97. ; Confirmation Page
  98. Page custom ShowConfirmationPage ; just letting the user know what they chose to install
  99. ; Actual Installion Page
  100. !insertmacro MUI_PAGE_INSTFILES
  101. !insertmacro MUI_UNPAGE_CONFIRM
  102. !insertmacro MUI_UNPAGE_INSTFILES
  103. #!insertmacro MUI_UNPAGE_FINISH
  104. ;--------------------------------
  105. ;Languages; Add more languages later here if needed
  106. !insertmacro MUI_LANGUAGE "English"
  107. ;--------------------------------
  108. ;Installer Sections
  109. Section "!Jellyfin Server (required)" InstallJellyfinServer
  110. SectionIn RO ; Mandatory section, isn't this the whole purpose to run the installer.
  111. StrCmp "$_EXISTINGINSTALLATION_" "Yes" RunUninstaller CarryOn ; Silently uninstall in case of previous installation
  112. RunUninstaller:
  113. DetailPrint "Looking for uninstaller at $INSTDIR"
  114. FindFirst $0 $1 "$INSTDIR\Uninstall.exe"
  115. FindClose $0
  116. StrCmp $1 "" CarryOn ; the registry key was there but uninstaller was not found
  117. DetailPrint "Silently running the uninstaller at $INSTDIR"
  118. ExecWait '"$INSTDIR\Uninstall.exe" /S _?=$INSTDIR' $0
  119. DetailPrint "Uninstall finished, $0"
  120. CarryOn:
  121. ${If} $_EXISTINGSERVICE_ == 'Yes'
  122. ExecWait '"$INSTDIR\nssm.exe" stop JellyfinServer' $0
  123. ${If} $0 <> 0
  124. MessageBox MB_OK|MB_ICONSTOP "Could not stop the Jellyfin Server service."
  125. Abort
  126. ${EndIf}
  127. DetailPrint "Stopped Jellyfin Server service, $0"
  128. ${EndIf}
  129. SetOutPath "$INSTDIR"
  130. File /r $%InstallLocation%\*
  131. ; Write the InstallFolder, DataFolder, Network Service info into the registry for later use
  132. WriteRegExpandStr HKLM "${REG_CONFIG_KEY}" "InstallFolder" "$INSTDIR"
  133. WriteRegExpandStr HKLM "${REG_CONFIG_KEY}" "DataFolder" "$_JELLYFINDATADIR_"
  134. WriteRegStr HKLM "${REG_CONFIG_KEY}" "ServiceAccountType" "$_SERVICEACCOUNTTYPE_"
  135. !getdllversion "$%InstallLocation%\jellyfin.dll" ver_
  136. StrCpy $_JELLYFINVERSION_ "${ver_1}.${ver_2}.${ver_3}" ;
  137. ; Write the uninstall keys for Windows
  138. WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayName" "Jellyfin Server $_JELLYFINVERSION_ ${NAMESUFFIX}"
  139. WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  140. WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayIcon" '"$INSTDIR\Uninstall.exe",0'
  141. WriteRegStr HKLM "${REG_UNINST_KEY}" "Publisher" "The Jellyfin Project"
  142. WriteRegStr HKLM "${REG_UNINST_KEY}" "URLInfoAbout" "https://jellyfin.org/"
  143. WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayVersion" "$_JELLYFINVERSION_"
  144. WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoModify" 1
  145. WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoRepair" 1
  146. ;Create uninstaller
  147. WriteUninstaller "$INSTDIR\Uninstall.exe"
  148. SectionEnd
  149. Section "Jellyfin Server Service" InstallService
  150. ExecWait '"$INSTDIR\nssm.exe" statuscode JellyfinServer' $0
  151. DetailPrint "Jellyfin Server service statuscode, $0"
  152. ${If} $0 == 0
  153. InstallRetry:
  154. ExecWait '"$INSTDIR\nssm.exe" install JellyfinServer "$INSTDIR\jellyfin.exe" --datadir \"$_JELLYFINDATADIR_\"' $0
  155. ${If} $0 <> 0
  156. !insertmacro ShowError "Could not install the Jellyfin Server service." InstallRetry
  157. ${EndIf}
  158. DetailPrint "Jellyfin Server Service install, $0"
  159. ${Else}
  160. DetailPrint "Jellyfin Server Service exists, updating..."
  161. ConfigureApplicationRetry:
  162. ExecWait '"$INSTDIR\nssm.exe" set JellyfinServer Application "$INSTDIR\jellyfin.exe"' $0
  163. ${If} $0 <> 0
  164. !insertmacro ShowError "Could not configure the Jellyfin Server service." ConfigureApplicationRetry
  165. ${EndIf}
  166. DetailPrint "Jellyfin Server Service setting (Application), $0"
  167. ConfigureAppParametersRetry:
  168. ExecWait '"$INSTDIR\nssm.exe" set JellyfinServer AppParameters --datadir \"$_JELLYFINDATADIR_\"' $0
  169. ${If} $0 <> 0
  170. !insertmacro ShowError "Could not configure the Jellyfin Server service." ConfigureAppParametersRetry
  171. ${EndIf}
  172. DetailPrint "Jellyfin Server Service setting (AppParameters), $0"
  173. ${EndIf}
  174. Sleep 3000 ; Give time for Windows to catchup
  175. ConfigureStartRetry:
  176. ExecWait '"$INSTDIR\nssm.exe" set JellyfinServer Start SERVICE_DELAYED_AUTO_START' $0
  177. ${If} $0 <> 0
  178. !insertmacro ShowError "Could not configure the Jellyfin Server service." ConfigureStartRetry
  179. ${EndIf}
  180. DetailPrint "Jellyfin Server Service setting (Start), $0"
  181. ConfigureDescriptionRetry:
  182. ExecWait '"$INSTDIR\nssm.exe" set JellyfinServer Description "Jellyfin Server: The Free Software Media System"' $0
  183. ${If} $0 <> 0
  184. !insertmacro ShowError "Could not configure the Jellyfin Server service." ConfigureDescriptionRetry
  185. ${EndIf}
  186. DetailPrint "Jellyfin Server Service setting (Description), $0"
  187. ConfigureDisplayNameRetry:
  188. ExecWait '"$INSTDIR\nssm.exe" set JellyfinServer DisplayName "Jellyfin Server"' $0
  189. ${If} $0 <> 0
  190. !insertmacro ShowError "Could not configure the Jellyfin Server service." ConfigureDisplayNameRetry
  191. ${EndIf}
  192. DetailPrint "Jellyfin Server Service setting (DisplayName), $0"
  193. Sleep 3000
  194. ${If} $_SERVICEACCOUNTTYPE_ == "NetworkService" ; the default install using NSSM is Local System
  195. ConfigureNetworkServiceRetry:
  196. ExecWait '"$INSTDIR\nssm.exe" set JellyfinServer Objectname "Network Service"' $0
  197. ${If} $0 <> 0
  198. !insertmacro ShowError "Could not configure the Jellyfin Server service account." ConfigureNetworkServiceRetry
  199. ${EndIf}
  200. DetailPrint "Jellyfin Server service account change, $0"
  201. ${EndIf}
  202. SectionEnd
  203. Section "-start service" StartService
  204. ${If} $_SERVICESTART_ == "Yes"
  205. ${AndIf} $_INSTALLSERVICE_ == "Yes"
  206. StartRetry:
  207. ExecWait '"$INSTDIR\nssm.exe" start JellyfinServer' $0
  208. ${If} $0 <> 0
  209. !insertmacro ShowError "Could not start the Jellyfin Server service." StartRetry
  210. ${EndIf}
  211. DetailPrint "Jellyfin Server service start, $0"
  212. ${EndIf}
  213. SectionEnd
  214. ;--------------------------------
  215. ;Descriptions
  216. ;Language strings
  217. LangString DESC_InstallJellyfinServer ${LANG_ENGLISH} "Install Jellyfin Server"
  218. LangString DESC_InstallService ${LANG_ENGLISH} "Install As a Service"
  219. ;Assign language strings to sections
  220. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  221. !insertmacro MUI_DESCRIPTION_TEXT ${InstallJellyfinServer} $(DESC_InstallJellyfinServer)
  222. !insertmacro MUI_DESCRIPTION_TEXT ${InstallService} $(DESC_InstallService)
  223. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  224. ;--------------------------------
  225. ;Uninstaller Section
  226. Section "Uninstall"
  227. ReadRegStr $INSTDIR HKLM "${REG_CONFIG_KEY}" "InstallFolder" ; read the installation folder
  228. ReadRegStr $_JELLYFINDATADIR_ HKLM "${REG_CONFIG_KEY}" "DataFolder" ; read the data folder
  229. DetailPrint "Jellyfin Install location: $INSTDIR"
  230. DetailPrint "Jellyfin Data folder: $_JELLYFINDATADIR_"
  231. MessageBox MB_YESNO|MB_ICONINFORMATION "Do you want to retain the Jellyfin Server data folder? The media will not be touched. $\r$\nIf unsure choose YES." /SD IDYES IDYES PreserveData
  232. RMDir /r /REBOOTOK "$_JELLYFINDATADIR_"
  233. PreserveData:
  234. ExecWait '"$INSTDIR\nssm.exe" statuscode JellyfinServer' $0
  235. DetailPrint "Jellyfin Server service statuscode, $0"
  236. IntCmp $0 0 NoServiceUninstall ; service doesn't exist, may be run from desktop shortcut
  237. Sleep 3000 ; Give time for Windows to catchup
  238. UninstallStopRetry:
  239. ExecWait '"$INSTDIR\nssm.exe" stop JellyfinServer' $0
  240. ${If} $0 <> 0
  241. !insertmacro ShowError "Could not stop the Jellyfin Server service." UninstallStopRetry
  242. ${EndIf}
  243. DetailPrint "Stopped Jellyfin Server service, $0"
  244. UninstallRemoveRetry:
  245. ExecWait '"$INSTDIR\nssm.exe" remove JellyfinServer confirm' $0
  246. ${If} $0 <> 0
  247. !insertmacro ShowError "Could not remove the Jellyfin Server service." UninstallRemoveRetry
  248. ${EndIf}
  249. DetailPrint "Removed Jellyfin Server service, $0"
  250. Sleep 3000 ; Give time for Windows to catchup
  251. NoServiceUninstall: ; existing install was present but no service was detected
  252. Delete "$INSTDIR\*.*"
  253. RMDir /r /REBOOTOK "$INSTDIR\jellyfin-web"
  254. Delete "$INSTDIR\Uninstall.exe"
  255. RMDir /r /REBOOTOK "$INSTDIR"
  256. DeleteRegKey HKLM "Software\Jellyfin"
  257. DeleteRegKey HKLM "${REG_UNINST_KEY}"
  258. SectionEnd
  259. Function .onInit
  260. ; Setting up defaults
  261. StrCpy $_INSTALLSERVICE_ "No"
  262. StrCpy $_SERVICESTART_ "Yes"
  263. StrCpy $_SERVICEACCOUNTTYPE_ "NetworkService"
  264. StrCpy $_EXISTINGINSTALLATION_ "No"
  265. StrCpy $_EXISTINGSERVICE_ "No"
  266. SetShellVarContext current
  267. StrCpy $_JELLYFINDATADIR_ "$%ProgramData%\Jellyfin\Server"
  268. System::Call 'kernel32::CreateMutex(p 0, i 0, t "JellyfinServerMutex") p .r1 ?e'
  269. Pop $R0
  270. StrCmp $R0 0 +3
  271. !insertmacro ShowErrorFinal "The installer is already running."
  272. ;Detect if Jellyfin is already installed.
  273. ; In case it is installed, let the user choose either
  274. ; 1. Exit installer
  275. ; 2. Upgrade without messing with data
  276. ; 2a. Don't ask for any details, uninstall and install afresh with old settings
  277. ; Read Registry for previous installation
  278. ClearErrors
  279. ReadRegStr "$0" HKLM "${REG_CONFIG_KEY}" "InstallFolder"
  280. IfErrors NoExisitingInstall
  281. DetailPrint "Existing Jellyfin Server detected at: $0"
  282. StrCpy "$INSTDIR" "$0" ; set the location fro registry as new default
  283. StrCpy $_EXISTINGINSTALLATION_ "Yes" ; Set our flag to be used later
  284. SectionSetText ${InstallJellyfinServer} "Upgrade Jellyfin Server (required)" ; Change install text to "Upgrade"
  285. ; check if there is a service called Jellyfin, there should be
  286. ; hack : nssm statuscode Jellyfin will return non zero return code in case it exists
  287. ExecWait '"$INSTDIR\nssm.exe" statuscode JellyfinServer' $0
  288. DetailPrint "Jellyfin Server service statuscode, $0"
  289. IntCmp $0 0 NoService ; service doesn't exist, may be run from desktop shortcut
  290. ; if service was detected, set defaults going forward.
  291. StrCpy $_EXISTINGSERVICE_ "Yes"
  292. StrCpy $_INSTALLSERVICE_ "Yes"
  293. StrCpy $_SERVICESTART_ "Yes"
  294. ; check if service was run using Network Service account
  295. ClearErrors
  296. ReadRegStr $_SERVICEACCOUNTTYPE_ HKLM "${REG_CONFIG_KEY}" "ServiceAccountType" ; in case of error _SERVICEACCOUNTTYPE_ will be NetworkService as default
  297. ClearErrors
  298. ReadRegStr $_JELLYFINDATADIR_ HKLM "${REG_CONFIG_KEY}" "DataFolder" ; in case of error, the default holds
  299. ; Hide sections which will not be needed in case of previous install
  300. ; SectionSetText ${InstallService} ""
  301. NoService: ; existing install was present but no service was detected
  302. ; Let the user know that we'll upgrade and provide an option to quit.
  303. MessageBox MB_OKCANCEL|MB_ICONINFORMATION "Existing installation of Jellyfin Server was detected, it'll be upgraded, settings will be retained. \
  304. $\r$\nClick OK to proceed, Cancel to exit installer." /SD IDOK IDOK ProceedWithUpgrade
  305. Quit ; Quit if the user is not sure about upgrade
  306. ProceedWithUpgrade:
  307. NoExisitingInstall:
  308. ; by this time, the variables have been correctly set to reflect previous install details
  309. FunctionEnd
  310. Function HideInstallDirectoryPage
  311. ${If} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for InstallFolder
  312. Abort
  313. ${EndIf}
  314. FunctionEnd
  315. Function HideDataDirectoryPage
  316. ${If} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for InstallFolder
  317. Abort
  318. ${EndIf}
  319. FunctionEnd
  320. Function HideServiceConfigPage
  321. ${If} $_INSTALLSERVICE_ == "No" ; Not running as a service, don't ask for service type
  322. ${OrIf} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for InstallFolder
  323. Abort
  324. ${EndIf}
  325. FunctionEnd
  326. Function HideConfirmationPage
  327. ${If} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for InstallFolder
  328. Abort
  329. ${EndIf}
  330. FunctionEnd
  331. Function HideSetupTypePage
  332. ${If} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for InstallFolder
  333. Abort
  334. ${EndIf}
  335. FunctionEnd
  336. ; Setup Type dialog show function
  337. Function ShowSetupTypePage
  338. Call HideSetupTypePage
  339. Call fnc_setuptype_Create
  340. nsDialogs::Show
  341. FunctionEnd
  342. ; Service Config dialog show function
  343. Function ShowServiceConfigPage
  344. Call HideServiceConfigPage
  345. Call fnc_service_config_Create
  346. nsDialogs::Show
  347. FunctionEnd
  348. ; Confirmation dialog show function
  349. Function ShowConfirmationPage
  350. Call HideConfirmationPage
  351. Call fnc_confirmation_Create
  352. nsDialogs::Show
  353. FunctionEnd
  354. ; Declare temp variables to read the options from the custom page.
  355. Var StartServiceAfterInstall
  356. Var UseNetworkServiceAccount
  357. Var UseLocalSystemAccount
  358. Function ServiceConfigPage_Config
  359. ${NSD_GetState} $hCtl_service_config_StartServiceAfterInstall $StartServiceAfterInstall
  360. ${If} $StartServiceAfterInstall == 1
  361. StrCpy $_SERVICESTART_ "Yes"
  362. ${Else}
  363. StrCpy $_SERVICESTART_ "No"
  364. ${EndIf}
  365. ${NSD_GetState} $hCtl_service_config_UseNetworkServiceAccount $UseNetworkServiceAccount
  366. ${NSD_GetState} $hCtl_service_config_UseLocalSystemAccount $UseLocalSystemAccount
  367. ${If} $UseNetworkServiceAccount == 1
  368. StrCpy $_SERVICEACCOUNTTYPE_ "NetworkService"
  369. ${ElseIf} $UseLocalSystemAccount == 1
  370. StrCpy $_SERVICEACCOUNTTYPE_ "LocalSystem"
  371. ${Else}
  372. !insertmacro ShowErrorFinal "Service account type not properly configured."
  373. ${EndIf}
  374. FunctionEnd
  375. ; This function handles the choices during component selection
  376. Function .onSelChange
  377. ; If we are not installing service, we don't need to set the NetworkService account or StartService
  378. SectionGetFlags ${InstallService} $0
  379. ${If} $0 = ${SF_SELECTED}
  380. StrCpy $_INSTALLSERVICE_ "Yes"
  381. ${Else}
  382. StrCpy $_INSTALLSERVICE_ "No"
  383. StrCpy $_SERVICESTART_ "No"
  384. StrCpy $_SERVICEACCOUNTTYPE_ "None"
  385. ${EndIf}
  386. FunctionEnd
  387. Function .onInstSuccess
  388. #ExecShell "open" "http://localhost:8096"
  389. FunctionEnd