From c8ffa2fb1d2c56306fa9bca19d73c9842ba5b0b4 Mon Sep 17 00:00:00 2001 From: Anthony Lavado Date: Sat, 12 Oct 2019 03:03:33 -0400 Subject: [PATCH 01/20] Set service install default to no --- deployment/windows/jellyfin.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/windows/jellyfin.nsi b/deployment/windows/jellyfin.nsi index e33efde916..8b6c1e01e7 100644 --- a/deployment/windows/jellyfin.nsi +++ b/deployment/windows/jellyfin.nsi @@ -321,7 +321,7 @@ SectionEnd Function .onInit ; Setting up defaults - StrCpy $_INSTALLSERVICE_ "Yes" + StrCpy $_INSTALLSERVICE_ "No" StrCpy $_SERVICESTART_ "Yes" StrCpy $_SERVICEACCOUNTTYPE_ "NetworkService" StrCpy $_EXISTINGINSTALLATION_ "No" From 04c4ad731e36fc36d5e924cc7adf0e12f25cf1b5 Mon Sep 17 00:00:00 2001 From: Anthony Lavado Date: Sat, 12 Oct 2019 03:56:46 -0400 Subject: [PATCH 02/20] Begin to add setup type dialog --- deployment/windows/dialogs/setuptype.nsddef | 12 +++++ deployment/windows/dialogs/setuptype.nsdinc | 56 +++++++++++++++++++++ deployment/windows/jellyfin.nsi | 20 +++++++- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 deployment/windows/dialogs/setuptype.nsddef create mode 100644 deployment/windows/dialogs/setuptype.nsdinc diff --git a/deployment/windows/dialogs/setuptype.nsddef b/deployment/windows/dialogs/setuptype.nsddef new file mode 100644 index 0000000000..ff59f62152 --- /dev/null +++ b/deployment/windows/dialogs/setuptype.nsddef @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/deployment/windows/dialogs/setuptype.nsdinc b/deployment/windows/dialogs/setuptype.nsdinc new file mode 100644 index 0000000000..0b171da282 --- /dev/null +++ b/deployment/windows/dialogs/setuptype.nsdinc @@ -0,0 +1,56 @@ +; ========================================================= +; This file was generated by NSISDialogDesigner 1.4.4.0 +; http://coolsoft.altervista.org/nsisdialogdesigner +; +; Do not edit it manually, use NSISDialogDesigner instead! +; ========================================================= + +; handle variables +Var hCtl_setuptype +Var hCtl_setuptype_InstallasaServiceLabel +Var hCtl_setuptype_InstallasaService +Var hCtl_setuptype_BasicInstallLabel +Var hCtl_setuptype_BasicInstall +Var hCtl_setuptype_Font1 + + +; dialog create function +Function fnc_setuptype_Create + + ; custom font definitions + CreateFont $hCtl_setuptype_Font1 "Microsoft Sans Serif" "8.25" "700" + + ; === setuptype (type: Dialog) === + nsDialogs::Create 1018 + Pop $hCtl_setuptype + ${If} $hCtl_setuptype == error + Abort + ${EndIf} + !insertmacro MUI_HEADER_TEXT "This controls how Jellyfin is installed." "Setup Type" + + ; === InstallasaServiceLabel (type: Label) === + ${NSD_CreateLabel} 8u 71u 280u 28u "Install Jellyfin as a service. This method is recommended for Advanced Users. Additional setup is required to access network shares." + Pop $hCtl_setuptype_InstallasaServiceLabel + + ; === InstallasaService (type: RadioButton) === + ${NSD_CreateRadioButton} 8u 54u 280u 15u "Install as a Service (Advanced Users)" + Pop $hCtl_setuptype_InstallasaService + ${NSD_AddStyle} $hCtl_setuptype_InstallasaService ${WS_GROUP} + + ; === BasicInstallLabel (type: Label) === + ${NSD_CreateLabel} 8u 24u 280u 28u "The basic install will run Jellyfin in your current user account.$\nThis is recommended for new users and those with existing Jellyfin installs older than 10.4." + Pop $hCtl_setuptype_BasicInstallLabel + + ; === BasicInstall (type: RadioButton) === + ${NSD_CreateRadioButton} 8u 7u 280u 15u "Basic Install (Recommended)" + Pop $hCtl_setuptype_BasicInstall + SendMessage $hCtl_setuptype_BasicInstall ${WM_SETFONT} $hCtl_setuptype_Font1 0 + ${NSD_Check} $hCtl_setuptype_BasicInstall + +FunctionEnd + +; dialog show function +Function fnc_setuptype_Show + Call fnc_setuptype_Create + nsDialogs::Show +FunctionEnd diff --git a/deployment/windows/jellyfin.nsi b/deployment/windows/jellyfin.nsi index 8b6c1e01e7..847666554e 100644 --- a/deployment/windows/jellyfin.nsi +++ b/deployment/windows/jellyfin.nsi @@ -16,6 +16,7 @@ ShowUninstDetails show ; Global variables that we'll use Var _JELLYFINVERSION_ Var _JELLYFINDATADIR_ + Var _SETUPTYPE_ Var _INSTALLSERVICE_ Var _SERVICESTART_ Var _SERVICEACCOUNTTYPE_ @@ -86,6 +87,9 @@ ShowUninstDetails show !insertmacro MUI_PAGE_WELCOME ; License Page !insertmacro MUI_PAGE_LICENSE "$%InstallLocation%\LICENSE" ; picking up generic GPL + +; Setup Type Page + Page custom ShowSetupTypePage SetupTypePage_Config ; Components Page !insertmacro MUI_PAGE_COMPONENTS !define MUI_PAGE_CUSTOMFUNCTION_PRE HideInstallDirectoryPage ; Controls when to hide / show @@ -102,6 +106,7 @@ ShowUninstDetails show !insertmacro MUI_PAGE_DIRECTORY ; Custom Dialogs + !include "dialogs\setuptype.nsdinc" !include "dialogs\service-config.nsdinc" !include "dialogs\confirmation.nsdinc" @@ -170,7 +175,7 @@ Section "!Jellyfin Server (required)" InstallJellyfinServer WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"' WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayIcon" '"$INSTDIR\Uninstall.exe",0' WriteRegStr HKLM "${REG_UNINST_KEY}" "Publisher" "The Jellyfin Project" - WriteRegStr HKLM "${REG_UNINST_KEY}" "URLInfoAbout" "https://jellyfin.media/" + WriteRegStr HKLM "${REG_UNINST_KEY}" "URLInfoAbout" "https://jellyfin.org/" WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayVersion" "$_JELLYFINVERSION_" WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoModify" 1 WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoRepair" 1 @@ -413,6 +418,19 @@ Function HideConfirmationPage ${EndIf} FunctionEnd +Function HideSetupTypePage + ${If} $_EXISTINGINSTALLATION_ == "Yes" ; Existing installation detected, so don't ask for InstallFolder + Abort + ${EndIf} +FunctionEnd + +; Setup Type dialog show function +Function ShowSetupTypePage + Call HideSetupTypePage + Call fnc_setuptype_Create + nsDialogs::Show +FunctionEnd + ; Service Config dialog show function Function ShowServiceConfigPage Call HideServiceConfigPage From 05fb84ba2236b0fd0727caf29fad4986059c8b8e Mon Sep 17 00:00:00 2001 From: Anthony Lavado Date: Sat, 12 Oct 2019 04:39:34 -0400 Subject: [PATCH 03/20] Make service setup an optional component, remove setuptype page config for now --- deployment/windows/jellyfin.nsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deployment/windows/jellyfin.nsi b/deployment/windows/jellyfin.nsi index 847666554e..b8de4a4401 100644 --- a/deployment/windows/jellyfin.nsi +++ b/deployment/windows/jellyfin.nsi @@ -89,7 +89,8 @@ ShowUninstDetails show !insertmacro MUI_PAGE_LICENSE "$%InstallLocation%\LICENSE" ; picking up generic GPL ; Setup Type Page - Page custom ShowSetupTypePage SetupTypePage_Config + Page custom ShowSetupTypePage ;SetupTypePage_Config + ; Components Page !insertmacro MUI_PAGE_COMPONENTS !define MUI_PAGE_CUSTOMFUNCTION_PRE HideInstallDirectoryPage ; Controls when to hide / show @@ -184,7 +185,7 @@ Section "!Jellyfin Server (required)" InstallJellyfinServer WriteUninstaller "$INSTDIR\Uninstall.exe" SectionEnd -Section "Jellyfin Server Service" InstallService +Section /o "Jellyfin Server Service" InstallService ExecWait '"$INSTDIR\nssm.exe" statuscode JellyfinServer' $0 DetailPrint "Jellyfin Server service statuscode, $0" From 9ad781324ebdfb9679a0dcf4258195a870c0826c Mon Sep 17 00:00:00 2001 From: Anthony Lavado Date: Tue, 15 Oct 2019 04:24:30 -0400 Subject: [PATCH 04/20] 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. --- deployment/windows/dialogs/setuptype.nsdinc | 6 +--- deployment/windows/jellyfin.nsi | 34 ++++++++++++++++++--- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/deployment/windows/dialogs/setuptype.nsdinc b/deployment/windows/dialogs/setuptype.nsdinc index 0b171da282..6c30119331 100644 --- a/deployment/windows/dialogs/setuptype.nsdinc +++ b/deployment/windows/dialogs/setuptype.nsdinc @@ -49,8 +49,4 @@ Function fnc_setuptype_Create FunctionEnd -; dialog show function -Function fnc_setuptype_Show - Call fnc_setuptype_Create - nsDialogs::Show -FunctionEnd + diff --git a/deployment/windows/jellyfin.nsi b/deployment/windows/jellyfin.nsi index b8de4a4401..375c3cd798 100644 --- a/deployment/windows/jellyfin.nsi +++ b/deployment/windows/jellyfin.nsi @@ -89,9 +89,10 @@ ShowUninstDetails show !insertmacro MUI_PAGE_LICENSE "$%InstallLocation%\LICENSE" ; picking up generic GPL ; Setup Type Page - Page custom ShowSetupTypePage ;SetupTypePage_Config + Page custom ShowSetupTypePage SetupTypePage_Config ; Components Page + !define MUI_PAGE_CUSTOMFUNCTION_PRE HideComponentsPage !insertmacro MUI_PAGE_COMPONENTS !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 @@ -185,8 +186,8 @@ Section "!Jellyfin Server (required)" InstallJellyfinServer WriteUninstaller "$INSTDIR\Uninstall.exe" 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 DetailPrint "Jellyfin Server service statuscode, $0" ${If} $0 == 0 @@ -246,6 +247,7 @@ Section /o "Jellyfin Server Service" InstallService ${EndIf} DetailPrint "Jellyfin Server service account change, $0" ${EndIf} +${EndIf} SectionEnd @@ -327,7 +329,7 @@ SectionEnd Function .onInit ; Setting up defaults - StrCpy $_INSTALLSERVICE_ "No" + StrCpy $_INSTALLSERVICE_ "Yes" StrCpy $_SERVICESTART_ "Yes" StrCpy $_SERVICEACCOUNTTYPE_ "NetworkService" StrCpy $_EXISTINGINSTALLATION_ "No" @@ -420,7 +422,13 @@ Function HideConfirmationPage FunctionEnd 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 ${EndIf} FunctionEnd @@ -450,6 +458,22 @@ FunctionEnd Var StartServiceAfterInstall Var UseNetworkServiceAccount 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 ${NSD_GetState} $hCtl_service_config_StartServiceAfterInstall $StartServiceAfterInstall From f80343bf9dfa6d79df85b12cdd66d3602c269ebc Mon Sep 17 00:00:00 2001 From: Anthony Lavado Date: Wed, 16 Oct 2019 01:43:53 -0400 Subject: [PATCH 05/20] Fix the Setup Type dialog titles I had put the title and subtitle in the wrong order. This corrects the issue. --- deployment/windows/dialogs/setuptype.nsddef | 2 +- deployment/windows/dialogs/setuptype.nsdinc | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/deployment/windows/dialogs/setuptype.nsddef b/deployment/windows/dialogs/setuptype.nsddef index ff59f62152..b55ceeaaa6 100644 --- a/deployment/windows/dialogs/setuptype.nsddef +++ b/deployment/windows/dialogs/setuptype.nsddef @@ -4,7 +4,7 @@ This file was created by NSISDialogDesigner 1.4.4.0 http://coolsoft.altervista.org/nsisdialogdesigner Do not edit manually! --> - +