Browse Source

Fix up Setup Type dialog, and add logic for basic setup

Fix up the Setup Type dialog, by removing an unused function from the page.
Adds logic to the installer to check for a basic or advanced setup choice. Ensures that the service is only installed if the "advanced" method is chosen. Note - it may be possible to remove some defaults from the .onInit, considering they get set through the program now.
Anthony Lavado 5 years ago
parent
commit
9ad781324e
2 changed files with 30 additions and 10 deletions
  1. 1 5
      deployment/windows/dialogs/setuptype.nsdinc
  2. 29 5
      deployment/windows/jellyfin.nsi

+ 1 - 5
deployment/windows/dialogs/setuptype.nsdinc

@@ -49,8 +49,4 @@ Function fnc_setuptype_Create
   
   
 FunctionEnd
 FunctionEnd
 
 
-; dialog show function
-Function fnc_setuptype_Show
-  Call fnc_setuptype_Create
-  nsDialogs::Show
-FunctionEnd
+

+ 29 - 5
deployment/windows/jellyfin.nsi

@@ -89,9 +89,10 @@ ShowUninstDetails show
     !insertmacro MUI_PAGE_LICENSE "$%InstallLocation%\LICENSE" ; picking up generic GPL
     !insertmacro MUI_PAGE_LICENSE "$%InstallLocation%\LICENSE" ; picking up generic GPL
 
 
 ; Setup Type Page
 ; Setup Type Page
-    Page custom ShowSetupTypePage ;SetupTypePage_Config
+    Page custom ShowSetupTypePage SetupTypePage_Config
     
     
 ; Components Page
 ; Components Page
+    !define MUI_PAGE_CUSTOMFUNCTION_PRE HideComponentsPage
     !insertmacro MUI_PAGE_COMPONENTS
     !insertmacro MUI_PAGE_COMPONENTS
     !define MUI_PAGE_CUSTOMFUNCTION_PRE HideInstallDirectoryPage ; Controls when to hide / show
     !define MUI_PAGE_CUSTOMFUNCTION_PRE HideInstallDirectoryPage ; Controls when to hide / show
     !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Install folder" ; shows just above the folder selection dialog
     !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Install folder" ; shows just above the folder selection dialog
@@ -185,8 +186,8 @@ Section "!Jellyfin Server (required)" InstallJellyfinServer
     WriteUninstaller "$INSTDIR\Uninstall.exe"
     WriteUninstaller "$INSTDIR\Uninstall.exe"
 SectionEnd
 SectionEnd
 
 
-Section /o "Jellyfin Server Service" InstallService
-
+Section "Jellyfin Server Service" InstallService
+${If} $_INSTALLSERVICE_ == "Yes" ; Only run this if we're going to install the service!
     ExecWait '"$INSTDIR\nssm.exe" statuscode JellyfinServer' $0
     ExecWait '"$INSTDIR\nssm.exe" statuscode JellyfinServer' $0
     DetailPrint "Jellyfin Server service statuscode, $0"
     DetailPrint "Jellyfin Server service statuscode, $0"
     ${If} $0 == 0
     ${If} $0 == 0
@@ -246,6 +247,7 @@ Section /o "Jellyfin Server Service" InstallService
         ${EndIf}
         ${EndIf}
         DetailPrint "Jellyfin Server service account change, $0"
         DetailPrint "Jellyfin Server service account change, $0"
     ${EndIf}
     ${EndIf}
+${EndIf}
 
 
 SectionEnd
 SectionEnd
 
 
@@ -327,7 +329,7 @@ SectionEnd
 
 
 Function .onInit
 Function .onInit
 ; Setting up defaults
 ; Setting up defaults
-    StrCpy $_INSTALLSERVICE_ "No"
+    StrCpy $_INSTALLSERVICE_ "Yes"
     StrCpy $_SERVICESTART_ "Yes"
     StrCpy $_SERVICESTART_ "Yes"
     StrCpy $_SERVICEACCOUNTTYPE_ "NetworkService"
     StrCpy $_SERVICEACCOUNTTYPE_ "NetworkService"
     StrCpy $_EXISTINGINSTALLATION_ "No"
     StrCpy $_EXISTINGINSTALLATION_ "No"
@@ -420,7 +422,13 @@ Function HideConfirmationPage
 FunctionEnd
 FunctionEnd
 
 
 Function HideSetupTypePage
 Function HideSetupTypePage
-    ${If} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for InstallFolder
+    ${If} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for SetupType
+        Abort
+    ${EndIf}
+FunctionEnd
+
+Function HideComponentsPage
+     ${If} $_SETUPTYPE_ == "Basic" ; Basic installation chosen, don't show components choice
         Abort
         Abort
     ${EndIf}
     ${EndIf}
 FunctionEnd
 FunctionEnd
@@ -450,6 +458,22 @@ FunctionEnd
 Var StartServiceAfterInstall
 Var StartServiceAfterInstall
 Var UseNetworkServiceAccount
 Var UseNetworkServiceAccount
 Var UseLocalSystemAccount
 Var UseLocalSystemAccount
+Var BasicInstall
+
+
+Function SetupTypePage_Config
+${NSD_GetState} $hCtl_setuptype_BasicInstall $BasicInstall
+${If} $BasicInstall == 1
+    StrCpy $_SETUPTYPE_ "Basic"
+    StrCpy $_INSTALLSERVICE_ "No"
+    StrCpy $_SERVICESTART_ "No"
+    StrCpy $_SERVICEACCOUNTTYPE_ "None"
+${Else}
+    StrCpy $_SETUPTYPE_ "Advanced"
+    StrCpy $_INSTALLSERVICE_ "Yes"
+${EndIf}
+    
+FunctionEnd
 
 
 Function ServiceConfigPage_Config
 Function ServiceConfigPage_Config
 ${NSD_GetState} $hCtl_service_config_StartServiceAfterInstall $StartServiceAfterInstall
 ${NSD_GetState} $hCtl_service_config_StartServiceAfterInstall $StartServiceAfterInstall