Fixes a syntax error with the NoServiceUninstall section. Moves the detection of an existing Service and datadir further up, so it happens before we decide how the installation will happen. Removed a newline from a comment, and enhanced the existing directory check. Adds an existing folder check, as well as a prompt if the user wants to continue with it or not. Also adds the datadir property to shortcuts.
NoServiceUninstall: ; existing install was present but no service was detected. Remove shortcuts if account is set to none
{$If} $_SERVICEACCOUNTTYPE_ == "None"
${If} $_SERVICEACCOUNTTYPE_ == "None"
RMDir /r "$SMPROGRAMS\Jellyfin Server"
Delete "$DESKTOP\Jellyfin Server.lnk"
{$EndIf}
DetailPrint "Removed old shortcuts..."
${EndIf}
Delete "$INSTDIR\*.*"
RMDir /r /REBOOTOK "$INSTDIR\jellyfin-web"
@ -380,6 +382,16 @@ Function .onInit
StrCpy $_EXISTINGINSTALLATION_ "Yes" ; Set our flag to be used later
SectionSetText ${InstallJellyfinServer} "Upgrade Jellyfin Server (required)" ; Change install text to "Upgrade"
; check if service was run using Network Service account
ClearErrors
ReadRegStr $_SERVICEACCOUNTTYPE_ HKLM "${REG_CONFIG_KEY}" "ServiceAccountType" ; in case of error _SERVICEACCOUNTTYPE_ will be NetworkService as default
ClearErrors
ReadRegStr $_JELLYFINDATADIR_ HKLM "${REG_CONFIG_KEY}" "DataFolder" ; in case of error, the default holds
; Hide sections which will not be needed in case of previous install
; SectionSetText ${InstallService} ""
; check if there is a service called Jellyfin, there should be
; hack : nssm statuscode Jellyfin will return non zero return code in case it exists
; check if service was run using Network Service account
ClearErrors
ReadRegStr $_SERVICEACCOUNTTYPE_ HKLM "${REG_CONFIG_KEY}" "ServiceAccountType" ; in case of error _SERVICEACCOUNTTYPE_ will be NetworkService as default
ClearErrors
ReadRegStr $_JELLYFINDATADIR_ HKLM "${REG_CONFIG_KEY}" "DataFolder" ; in case of error, the default holds
; Hide sections which will not be needed in case of previous install
; SectionSetText ${InstallService} ""
NoService: ; existing install was present but no service was detected
${If} $_SERVICEACCOUNTTYPE_ == "None"
StrCpy $_SETUPTYPE_ "Basic"
@ -416,8 +419,7 @@ Function .onInit
ProceedWithUpgrade:
NoExisitingInstall:
; by this time, the variables have been correctly set to reflect previous install details
NoExisitingInstall: ; by this time, the variables have been correctly set to reflect previous install details