From f8ed1a3359e8aa124380917d4c778214ab987496 Mon Sep 17 00:00:00 2001 From: Gaspode69 <45949835+Gaspode69@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:10:27 +0200 Subject: [PATCH 1/5] Logging enhanced --- README.md | 4 ++++ build/windows/ioBroker.iss | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 41797d0..056ca80 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,10 @@ Pre-requires: ## Changelog +### **WORK IN PROGRESS** + +- (Gaspode) Logging enhanced + # 3.0.1 (25.02.2024) - (Gaspode) Cosmetic change for specific screen resolutions or scaling settings diff --git a/build/windows/ioBroker.iss b/build/windows/ioBroker.iss index 814b895..7d215e4 100644 --- a/build/windows/ioBroker.iss +++ b/build/windows/ioBroker.iss @@ -29,6 +29,7 @@ ; - 07.02.2024 Gaspode: Check for installer update at startup - ; - 08.02.2024 Gaspode: Refactored and optimized code, cleanup - ; - 25.02.2024 Gaspode: Cosmetic change for specific screen resolutions or scaling settings - +; - 25.04.2024 Gaspode: Logging enhanced - ; - - ; ---------------------------------------------------------------------------------------------- #define MyAppName "ioBroker automation platform" @@ -655,6 +656,11 @@ begin logPart := ''; end; + SaveStringToFile(myLogFileName, chr(13) + chr(10) + 'Executing:' + chr(13) + chr(10) + + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10) + + myCmd + chr(13) + chr(10) + + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10), true); + if (SaveStringToFile(tmpBatFileName, myCmd, false)) then begin if (Exec(ExpandConstant('{cmd}'), '/C ' + tmpBatFileName + logPart, wrkDir, SW_HIDE, ewWaitUntilTerminated, resultCode)) then begin Result := True; @@ -2339,7 +2345,7 @@ begin if dirExists(prefixPath) then begin SaveStringToFile(logFileName, '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10) + - 'Npm prefix path exists: ' + prefixPath + chr(13) + chr(10) + + 'Npm prefix path exists: ' + prefixPath + ' ---> OK' + chr(13) + chr(10) + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10), True); end else begin From 8e5a19cddd007d5338149fb67f0092d99aa7dfdf Mon Sep 17 00:00:00 2001 From: Gaspode69 <45949835+Gaspode69@users.noreply.github.com> Date: Tue, 7 May 2024 19:12:30 +0200 Subject: [PATCH 2/5] Implement JS-Controller update --- README.md | 4 +- build/windows/ioBroker.iss | 306 ++++++++++++++++++++------ build/windows/language/dutch.txt | 8 + build/windows/language/english.txt | 8 + build/windows/language/french.txt | 8 + build/windows/language/german.txt | 8 + build/windows/language/italian.txt | 8 + build/windows/language/polish.txt | 8 + build/windows/language/portuguese.txt | 8 + build/windows/language/russian.txt | 8 + build/windows/language/spanish.txt | 8 + build/windows/language/ukrainian.txt | 8 + 12 files changed, 324 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index 056ca80..a5d3a0b 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ Pre-requires: ### **WORK IN PROGRESS** -- (Gaspode) Logging enhanced +(Gaspode) Logging enhanced +(Gaspode) Fixed: Checking Admin port after installation fails if Node.js was not installed when the installation started +(Gaspode) Update/Upgrade of JS-Controller implemented - # 3.0.1 (25.02.2024) diff --git a/build/windows/ioBroker.iss b/build/windows/ioBroker.iss index 7d215e4..9e19f97 100644 --- a/build/windows/ioBroker.iss +++ b/build/windows/ioBroker.iss @@ -30,6 +30,9 @@ ; - 08.02.2024 Gaspode: Refactored and optimized code, cleanup - ; - 25.02.2024 Gaspode: Cosmetic change for specific screen resolutions or scaling settings - ; - 25.04.2024 Gaspode: Logging enhanced - +; - 07.05.2024 Gaspode: Fixed: Checking Admin port after installation fails if Node.js was not - +; installed when the installation started - +; - 07.05.2024 Gaspode: Update/Upgrade of JS-Controller implemented - ; - - ; ---------------------------------------------------------------------------------------------- #define MyAppName "ioBroker automation platform" @@ -169,6 +172,7 @@ var sumInfo3NodeLabel: TLabel; sumInfo1IoBrokerLabel: TLabel; sumInfo2IoBrokerLabel: TLabel; + sumInfo2IoBrokerNewestLabel: TLabel; sumInfo1IoBrokerRunLabel: TLabel; sumInfo2IoBrokerRunLabel: TLabel; sumInfo1PortStatesLabelA: TLabel; @@ -257,9 +261,13 @@ var iobTargetServiceName: String; // The target service name of the currently to be installed iob server installation - iobVersionMajor: Integer; // Major Version of the currently handled iob server installation - iobVersionMinor: Integer; // Minor Version of the currently handled iob server installation - iobVersionPatch: Integer; // Patch Version of the currently handled iob server installation + iobVersionMajor: Integer; // Major Version of the currently handled iob server installation + iobVersionMinor: Integer; // Minor Version of the currently handled iob server installation + iobVersionPatch: Integer; // Patch Version of the currently handled iob server installation + + iobVersionNewMajor: Integer; // Major Version of the currently available iob server version + iobVersionNewMinor: Integer; // Minor Version of the currently available iob server version + iobVersionNewPatch: Integer; // Patch Version of the currently available iob server version iobServiceExists: Boolean; // True if a windows service with service name 'iobServiceName' already exists iobInstalled: Boolean; // True if an ioBroker installation was found and verified in the currently handled path @@ -292,6 +300,7 @@ procedure showExpertMode(sender: TObject); forward; procedure expertModeCBClicked(sender: TObject); forward; function expertInstallationExists: Boolean; forward; procedure expertSelectDirectory(sender: TObject); forward; +function getIobAdminPort(iobPath: String): Integer; forward; {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Helper functions for the [xyz] sections of inno setup @@ -590,6 +599,32 @@ begin end end; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +function compareVersions(major1: Integer; minor1: Integer; patch1: Integer; major2: Integer; minor2: Integer; patch2: Integer): Integer; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +begin + if major1 = major2 then + begin + if minor1 = minor2 then + begin + if patch1 = patch2 then + Result := 0 + else if patch1 < patch2 then + Result := -1 + else + Result := 1; + end + else if minor1 < minor2 then + Result := -1 + else + Result := 1; + end + else if major1 < major2 then + Result := -1 + else + Result := 1; +end; + {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} function execAndReturnOutput(myCmd: String; allLines: Boolean; addPath: String; wrkDir: String): String; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} @@ -656,7 +691,7 @@ begin logPart := ''; end; - SaveStringToFile(myLogFileName, chr(13) + chr(10) + 'Executing:' + chr(13) + chr(10) + + SaveStringToFile(myLogFileName, chr(13) + chr(10) + 'Executing:' + chr(13) + chr(10) + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10) + myCmd + chr(13) + chr(10) + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10), true); @@ -770,6 +805,13 @@ begin end; end; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +function isIobUpdate: Boolean; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +begin + Result := (optInstallIoBrokerCB.Checked = True) and (iobVersionNewMajor > 0); +end; + {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Logfile names ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -788,6 +830,13 @@ begin Result := appInstPath + '\log\installIoBroker.log'; end; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +function getLogNameIoBrokerUpdate: String; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +begin + Result := appInstPath + '\log\updateIoBroker.log'; +end; + {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} function getLogNameIoBrokerFix: String; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} @@ -826,7 +875,8 @@ end; function ioBrokerNeedsStart: Boolean; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} begin - Result := (optInstallIoBrokerCB.Checked = False) and (optFixIoBrokerCB.Checked = False); + Result := (optInstallIoBrokerCB.Checked = False) and (optFixIoBrokerCB.Checked = False) or + isIobUpdate; end; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} @@ -909,6 +959,12 @@ begin if iobServiceOK then break; end; if iobServiceOK then begin + // If Node.js was not installed at the beginning, the Admin port is probably 0. + // In this case we try to fetch it again: + if iobAdminPort = 0 then begin + if nodepath = '' then gatherInstNodeData; + iobAdminPort := getIobAdminPort(appInstPath); + end; Log('ioBroker service was started!'); marqueePage.SetText(info, CustomMessage('WaitForAdmin')); for i := 0 to 100 do begin @@ -952,6 +1008,40 @@ begin end; end; + +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +procedure gatherNewestIoBrokerVersion(var major: Integer; var minor: Integer; var patch: Integer); +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +var + versionString: String; + nodeJsEx: String; + ioBrokerEx: String; + curPos: Integer; +begin + major := 0; + minor := 0; + patch := 0; + if (nodePath <> '') then begin + nodeJsEx := nodePath + '\node.exe'; + ioBrokerEx := appInstPath + '\node_modules\iobroker.js-controller/iobroker.js'; + versionString := execAndReturnOutput('"' + nodeJsEx + '" "' + ioBrokerEx + '" update | find "Controller ""js-controller"":"', True, nodePath, ''); + if (versionString <> '') then begin + curPos := 29; // |Controller "js-controller": | + versionString := Trim(Copy(versionString, curPos, Length(versionString) - curPos)); + curPos := pos(' ', versionString); + if (curPos > 0) then begin + versionString := Trim(Copy(versionString, 1, curPos-1)); + Log(Format('Latest ioBroker version: %s', [versionString])); + convertVersion(versionString, major, minor, patch); + Log(Format('Latest ioBroker version: %d, %d, %d', [major, minor, patch])); + end; + end + else begin + Log('Latest ioBroker version could not be detected!'); + end; + end; +end; + {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} function gatherIoBrokerInfo: Boolean; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} @@ -965,6 +1055,10 @@ begin iobVersionMinor := 0; iobVersionPatch := 0; + iobVersionNewMajor := 0; + iobVersionNewMinor := 0; + iobVersionNewPatch := 0; + ioBrokerEx := appInstPath + '\node_modules\iobroker.js-controller/iobroker.js'; if (FileExists(ioBrokerEx)) then begin Result := True; @@ -973,7 +1067,8 @@ begin versionString := execAndReturnOutput('"' + nodeJsEx + '" "' + ioBrokerEx + '" --version', False, nodePath, ''); if (convertVersion(versionString, iobVersionMajor, iobVersionMinor, iobVersionPatch)) then begin Log(Format('Found ioBroker version: %d, %d, %d', [iobVersionMajor, iobVersionMinor, iobVersionPatch])); - end + gatherNewestIoBrokerVersion(iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch); + end; end else begin iobControllerFoundNoNode := True; @@ -1335,24 +1430,26 @@ begin end; progressPage.SetProgress(progress, maxProgress); progress := progress + 1; - portInfo := getPortInfo(adminPort); - if portInfo <> '' then begin - explode(portInfoArray, portInfo, ';'); - sumInfo1PortAdminLabelA.Font.Color := clRed; - sumInfo1PortAdminLabelA.Caption := '⚠'; - if GetArrayLength(portInfoArray) >= 3 then begin - sumInfo2PortAdminLabelA.Caption := Format(CustomMessage('PortInUse'), [portInfoArray[0], portInfoArray[1], portInfoArray[2]]); + if adminPort > 0 then begin // If Node.js is not installed, the Admin port cannot be determined. We do not display it in this case + portInfo := getPortInfo(adminPort); + if portInfo <> '' then begin + explode(portInfoArray, portInfo, ';'); + sumInfo1PortAdminLabelA.Font.Color := clRed; + sumInfo1PortAdminLabelA.Caption := '⚠'; + if GetArrayLength(portInfoArray) >= 3 then begin + sumInfo2PortAdminLabelA.Caption := Format(CustomMessage('PortInUse'), [portInfoArray[0], portInfoArray[1], portInfoArray[2]]); + end + else begin + sumInfo2PortAdminLabelA.Caption := Format(' %s', [portInfo]); + end; + readyToInstall := False; + portsInUse := True; end else begin - sumInfo2PortAdminLabelA.Caption := Format(' %s', [portInfo]); + sumInfo1PortAdminLabelA.Font.Color := clGreen; + sumInfo1PortAdminLabelA.Caption := '✓'; + sumInfo2PortAdminLabelA.Caption := Format(CustomMessage('PortAvailable'), [adminPort]); end; - readyToInstall := False; - portsInUse := True; - end - else begin - sumInfo1PortAdminLabelA.Font.Color := clGreen; - sumInfo1PortAdminLabelA.Caption := '✓'; - sumInfo2PortAdminLabelA.Caption := Format(CustomMessage('PortAvailable'), [adminPort]); end; progressPage.SetProgress(progress, maxProgress); progress := progress + 1; end; @@ -1461,7 +1558,7 @@ begin summaryText := ''; portsInUse := False; readyToInstall := True; - maxProgress := 12; + maxProgress := 8; progress := 0; tryStopServiceAtNextRetry := False; @@ -1493,14 +1590,14 @@ begin sumInfo2NodeLabel.Caption := CustomMessage('NodeNotInstalled'); end else begin - if instNodeVersionMajor = rcmdNodeVersionMajor then begin + if (compareVersions(instNodeVersionMajor, instNodeVersionMinor, instNodeVersionPatch, rcmdNodeVersionMajor, rcmdNodeVersionMinor, rcmdNodeVersionPatch) = 0) then begin sumInfo1NodeLabel.Font.Color := clGreen; sumInfo1NodeLabel.Caption := '✓'; sumInfo2NodeLabel.Caption := Format(CustomMessage('NodeInstalled'), [instNodeVersionMajor, instNodeVersionMinor, instNodeVersionPatch, nodePath]); end else begin if isNodeVersionSupported(instNodeVersionMajor) then begin - sumInfo1NodeLabel.Font.Color := clYellow; + sumInfo1NodeLabel.Font.Color := $00A5FF; sumInfo1NodeLabel.Caption := '⚠'; sumInfo2NodeLabel.Caption := Format(CustomMessage('NodeInstalled'), [instNodeVersionMajor, instNodeVersionMinor, instNodeVersionPatch, nodePath]); end @@ -1527,9 +1624,32 @@ begin end end else begin - sumInfo1IoBrokerLabel.Font.Color := clGreen; - sumInfo1IoBrokerLabel.Caption := '✓'; + if (compareVersions(iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch, iobVersionMajor, iobVersionMinor, iobVersionPatch) > 0) then begin + sumInfo1IoBrokerLabel.Font.Color := $00A5FF; + sumInfo1IoBrokerLabel.Caption := '⚠'; + end + else begin + sumInfo1IoBrokerLabel.Font.Color := clGreen; + sumInfo1IoBrokerLabel.Caption := '✓'; + end; sumInfo2IoBrokerLabel.Caption := Format(CustomMessage('IoBrokerInstalled'), [iobVersionMajor, iobVersionMinor, iobVersionPatch, appInstPath]); + + if (iobVersionNewMajor = 0) then begin + sumInfo2IoBrokerNewestLabel.Caption := CustomMessage('IoBrokerNewestNotFound'); + end + else begin + if (compareVersions(iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch, iobVersionMajor, iobVersionMinor, iobVersionPatch) > 0) then begin + sumInfo2IoBrokerNewestLabel.Caption := Format(CustomMessage('IoBrokerNewestNewer'), [iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch]); + end + else begin + if (compareVersions(iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch, iobVersionMajor, iobVersionMinor, iobVersionPatch) = 0) then begin + sumInfo2IoBrokerNewestLabel.Caption := CustomMessage('IoBrokerNewestOK'); + end + else begin + sumInfo2IoBrokerNewestLabel.Caption := Format(CustomMessage('IoBrokerNewest'), [iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch]); + end; + end; + end; end; if iobRunning then begin @@ -1559,7 +1679,7 @@ begin sumInfo1PortAdminLabelB.Caption := ''; sumInfo2PortAdminLabelB.Caption := ''; - progressPage.SetProgress(progress, maxProgress); progress := progress +3; + progressPage.SetProgress(progress, maxProgress); progress := progress + 1; updateSummaryPagePortsA(iobStatesPort, iobObjectsPort, iobAdminPort, portsInUse, maxProgress, progress); end; @@ -1663,22 +1783,33 @@ begin optFixIoBrokerCB.Enabled := False; end else begin - optInstallIoBrokerCB.checked := False; - optInstallIoBrokerCB.Caption := ' ' + Format(CustomMessage('InstallIoBrokeralreadyInstalled'),[appInstPath]); - optInstallIoBrokerCB.Enabled := False; + if (compareVersions(iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch, iobVersionMajor, iobVersionMinor, iobVersionPatch) > 0) then begin + optInstallIoBrokerCB.checked := True; + optInstallIoBrokerCB.Caption := ' ' + Format(CustomMessage('InstallIoBrokerUpdate'),[iobVersionMajor, iobVersionMinor, iobVersionPatch, iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch]); + optInstallIoBrokerCB.Enabled := True; + + optFixIoBrokerCB.checked := False; + optFixIoBrokerCB.Caption := ' ' + Format(CustomMessage('FixIoBroker'),[appInstPath]); + optFixIoBrokerCB.Enabled := False; + end + else begin + optInstallIoBrokerCB.checked := False; + optInstallIoBrokerCB.Caption := ' ' + Format(CustomMessage('InstallIoBrokeralreadyInstalled'),[appInstPath]); + optInstallIoBrokerCB.Enabled := False; - optFixIoBrokerCB.checked := True; - optFixIoBrokerCB.Caption := ' ' + Format(CustomMessage('FixIoBroker'),[appInstPath]); - optFixIoBrokerCB.Enabled := True; + optFixIoBrokerCB.checked := True; + optFixIoBrokerCB.Caption := ' ' + Format(CustomMessage('FixIoBroker'),[appInstPath]); + optFixIoBrokerCB.Enabled := True; + end; end; - optAddFirewallRuleCB.Checked := optInstallIoBrokerCB.checked or firewallRuleSet; + optAddFirewallRuleCB.Checked := (optInstallIoBrokerCB.checked and not isIobUpdate) or firewallRuleSet; optAddFirewallRuleCB.Caption := ' ' + CustomMessage('AdaptFirewallRule'); optServiceAutoStartCB.Checked := isIobServiceAutoStartReg(iobServiceName); optServiceAutoStartCB.Caption := ' ' + CustomMessage('ServiceAutostart'); - if optInstallIoBrokerCB.Checked then begin + if optInstallIoBrokerCB.Checked and not isIobUpdate then begin optDataMigrationCB.Visible := True; optDataMigrationButton.Visible := True; optDataMigrationButton.Enabled := False; @@ -1698,13 +1829,19 @@ begin (optDataMigrationCB <> nil) and (optServiceAutoStartCB <> nil) then begin + if optInstallIoBrokerCB.Checked then begin + optFixIoBrokerCB.Checked := False; + optFixIoBrokerCB.Enabled := False; + end + else begin + optFixIoBrokerCB.Enabled := True; + end; if optInstallNodeCB.Checked or optInstallIoBrokerCB.Checked or optFixIoBrokerCB.Checked or optDataMigrationCB.Checked or (optServiceAutoStartCB.Checked <> isIobServiceAutoStartReg(iobServiceName)) or (optAddFirewallRuleCB.Checked <> firewallRuleSet) - then begin if optDataMigrationCB.Checked and (optDataMigrationLabel.Caption = '') then begin WizardForm.NextButton.Enabled := False; @@ -1763,6 +1900,7 @@ end; procedure createPages; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} begin + if summaryPage = nil then begin if isFirstInstallerRun then begin expertOptionsPage := CreateCustomPage(wpSelectDir, CustomMessage('ExpertMode'), CustomMessage('ExpertOptionsCaption')); @@ -1808,7 +1946,7 @@ begin with sumInfo1IoBrokerLabel do begin Parent := summaryPage.Surface; Left := ScaleX(8); - Top := sumInfo3NodeLabel.Top + sumInfo1NodeLabel.Height + ScaleY(12); + Top := sumInfo3NodeLabel.Top + sumInfo1NodeLabel.Height + ScaleY(8); Width := ScaleX(12); Height := ScaleY(12); Font.Style := [fsBold]; @@ -1818,7 +1956,16 @@ begin with sumInfo2IoBrokerLabel do begin Parent := summaryPage.Surface; Left := ScaleX(22); - Top := sumInfo3NodeLabel.Top + sumInfo1NodeLabel.Height + ScaleY(12); + Top := sumInfo3NodeLabel.Top + sumInfo1NodeLabel.Height + ScaleY(8); + Width := summaryPage.SurfaceWidth - ScaleX(22); + Height := ScaleY(12); + end; + + sumInfo2IoBrokerNewestLabel := TLabel.Create(WizardForm); + with sumInfo2IoBrokerNewestLabel do begin + Parent := summaryPage.Surface; + Left := ScaleX(22); + Top := sumInfo2IoBrokerLabel.Top + sumInfo2IoBrokerLabel.Height + ScaleY(4); Width := summaryPage.SurfaceWidth - ScaleX(22); Height := ScaleY(12); end; @@ -1827,7 +1974,7 @@ begin with sumInfo1IoBrokerRunLabel do begin Parent := summaryPage.Surface; Left := ScaleX(8); - Top := sumInfo1IoBrokerLabel.Top + sumInfo1IoBrokerLabel.Height + ScaleY(4); + Top := sumInfo2IoBrokerNewestLabel.Top + sumInfo2IoBrokerNewestLabel.Height + ScaleY(8); Width := ScaleX(12); Height := ScaleY(12); Font.Style := [fsBold]; @@ -1837,7 +1984,7 @@ begin with sumInfo2IoBrokerRunLabel do begin Parent := summaryPage.Surface; Left := ScaleX(22); - Top := sumInfo1IoBrokerLabel.Top + sumInfo1IoBrokerLabel.Height + ScaleY(4); + Top := sumInfo2IoBrokerNewestLabel.Top + sumInfo2IoBrokerNewestLabel.Height + ScaleY(8); Width := summaryPage.SurfaceWidth - ScaleX(22); Height := ScaleY(12); end; @@ -1846,7 +1993,7 @@ begin with sumInfo1PortStatesLabelA do begin Parent := summaryPage.Surface; Left := ScaleX(8); - Top := sumInfo2IoBrokerRunLabel.Top + sumInfo2IoBrokerRunLabel.Height + ScaleY(12); + Top := sumInfo2IoBrokerRunLabel.Top + sumInfo2IoBrokerRunLabel.Height + ScaleY(8); Width := ScaleX(12); Height := ScaleY(12); Font.Style := [fsBold]; @@ -1856,7 +2003,7 @@ begin with sumInfo2PortStatesLabelA do begin Parent := summaryPage.Surface; Left := ScaleX(22); - Top := sumInfo2IoBrokerRunLabel.Top + sumInfo2IoBrokerRunLabel.Height + ScaleY(12); + Top := sumInfo2IoBrokerRunLabel.Top + sumInfo2IoBrokerRunLabel.Height + ScaleY(8); Width := summaryPage.SurfaceWidth - ScaleX(22); Height := ScaleY(12); end; @@ -1959,7 +2106,7 @@ begin sumSummaryLabel := TLabel.Create(WizardForm); with sumSummaryLabel do begin Parent := summaryPage.Surface; - Top := sumInfo1PortAdminLabelB.Top + sumInfo1PortAdminLabelB.Height + ScaleY(10); + Top := sumInfo1PortAdminLabelB.Top + sumInfo1PortAdminLabelB.Height + ScaleY(8); Width := summaryPage.SurfaceWidth - ScaleX(4); Height := ScaleY(75); AutoSize := False; @@ -2372,6 +2519,9 @@ var LogName: String; info: String; output: String; + majorV: Integer; + minorV: Integer; + patchV: Integer; begin result := False; cmd := ''; @@ -2387,16 +2537,23 @@ begin end; if optInstallIoBrokerCB.Checked then begin - if iobServiceExists then begin + if iobServiceExists and not isIobUpdate then begin // Service exists, but ioBroker not installed. We remove the Service stopIobService(iobServiceName, ''); output := execAndReturnOutput('sc delete ' + iobServiceName + '.exe', False, '', ''); Log('Delete Service: ' + output); end; gatherInstNodeData; - cmd := '"' + nodePath + '\npx" --yes @iobroker/install@latest'; - LogName := getLogNameIoBrokerInstall; - info := CustomMessage('InstallingIoBroker'); + if isIobUpdate then begin + cmd := '"' + nodePath + '\node.exe" "' + appInstPath + '\node_modules\iobroker.js-controller/iobroker.js" upgrade self'; + LogName := getLogNameIoBrokerUpdate; + info := Format(CustomMessage('UpdatingIoBroker'), [iobVersionMajor, iobVersionMinor, iobVersionPatch, iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch]); + end + else begin + cmd := '"' + nodePath + '\npx" --yes @iobroker/install@latest'; + LogName := getLogNameIoBrokerInstall; + info := CustomMessage('InstallingIoBroker'); + end; end else begin if optFixIoBrokerCB.Checked then begin @@ -2419,20 +2576,26 @@ begin // Don't panic, fix will restore it anyway, and install will install it anyway DeleteFile(appInstPath + '\iobroker.bat'); if execAndStoreOutput(cmd , LogName, nodePath, appInstPath) then begin - - if (FileExists(appInstPath + '\instDone')) then begin - if expertCB.Checked and exoNewServerRB.Checked and optInstallIoBrokerCB.Checked or optDataMigrationCB.Checked then begin - Result := reconfigureIoBroker(info, LogName); - if not Result then begin - MsgBox(CustomMessage('ReconfigureError'), mbError, MB_OK or MB_SETFOREGROUND); - Exit; - end; - end; - Log('ioBroker installation/fixing completed!'); - Result := checkIoBrokerRunning(info); + if isIobUpdate then begin + // In this case no instDone file is created, we have to verify the success in another way: + gatherNewestIoBrokerVersion(majorV, minorV, patchV); + Result := compareVersions(iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch, majorV, minorV, patchV) = 0; end else begin - Log('ioBroker installation/fixing did not run til the end!'); + if (FileExists(appInstPath + '\instDone')) then begin + if expertCB.Checked and exoNewServerRB.Checked and optInstallIoBrokerCB.Checked or optDataMigrationCB.Checked then begin + Result := reconfigureIoBroker(info, LogName); + if not Result then begin + MsgBox(CustomMessage('ReconfigureError'), mbError, MB_OK or MB_SETFOREGROUND); + Exit; + end; + end; + Log('ioBroker installation/fixing completed!'); + Result := checkIoBrokerRunning(info); + end + else begin + Log('ioBroker installation/fixing did not run til the end!'); + end; end; end else begin @@ -2820,7 +2983,7 @@ begin WizardForm.ReadyLabel.Caption := CustomMessage('ReadyUninstall'); end else begin - if not optInstallIoBrokerCB.checked then begin + if not optInstallIoBrokerCB.checked or isIobUpdate then begin WizardForm.NextButton.Caption := CustomMessage('Update'); WizardForm.PageNameLabel.Caption := CustomMessage('ReadyMaintainTitle');; WizardForm.PageDescriptionLabel.Caption := CustomMessage('ReadyMaintainSubTitle'); @@ -2924,9 +3087,11 @@ begin // Remove old log files and old semaphore file DeleteFile(getLogNameNodeJsInstall + '_old'); DeleteFile(getLogNameIoBrokerInstall + '_old'); + DeleteFile(getLogNameIoBrokerUpdate + '_old'); DeleteFile(getLogNameIoBrokerFix + '_old'); RenameFile(getLogNameNodeJsInstall, getLogNameNodeJsInstall + '_old'); RenameFile(getLogNameIoBrokerInstall, getLogNameIoBrokerInstall + '_old'); + RenameFile(getLogNameIoBrokerUpdate, getLogNameIoBrokerUpdate + '_old'); RenameFile(getLogNameIoBrokerFix, getLogNameIoBrokerFix + '_old'); DeleteFile(appInstPath + '\instDone'); @@ -2952,8 +3117,14 @@ begin if cont then begin if installIoBroker = False then begin if optInstallIoBrokerCB.Checked then begin - MsgBox(CustomMessage('InstallationFailedIoBroker'), mbError, MB_OK or MB_SETFOREGROUND); - Exec('notepad', getLogNameIoBrokerInstall, '', SW_SHOWNORMAL, ewNoWait, resultCode); + if isIobUpdate then begin + MsgBox(CustomMessage('UpdatingFailedIoBroker'), mbError, MB_OK or MB_SETFOREGROUND); + Exec('notepad', getLogNameIoBrokerUpdate, '', SW_SHOWNORMAL, ewNoWait, resultCode); + end + else begin + MsgBox(CustomMessage('InstallationFailedIoBroker'), mbError, MB_OK or MB_SETFOREGROUND); + Exec('notepad', getLogNameIoBrokerInstall, '', SW_SHOWNORMAL, ewNoWait, resultCode); + end; end else begin MsgBox(CustomMessage('InstallationFailedIoBrokerFix'), mbError, MB_OK or MB_SETFOREGROUND); @@ -3065,8 +3236,13 @@ begin Result := Result + NewLine + NewLine + 'ioBroker:'; if optInstallIoBrokerCB.checked then begin - Result := Result + NewLine + Space + Format(CustomMessage('SummaryInstallIoBroker'), [appInstPath]); - Result := Result + NewLine + Space + Format(CustomMessage('SummaryIoBrokerServiceCreateDyn'), [iobServiceName]); + if isIobUpdate then begin + Result := Result + NewLine + Space + Format(CustomMessage('SummaryInstallIoBrokerUpdate'), [iobVersionMajor, iobVersionMinor, iobVersionPatch, iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch]); + end + else begin + Result := Result + NewLine + Space + Format(CustomMessage('SummaryInstallIoBroker'), [appInstPath]); + Result := Result + NewLine + Space + Format(CustomMessage('SummaryIoBrokerServiceCreateDyn'), [iobServiceName]); + end; end else begin if iobversionMajor > 0 then begin @@ -3102,7 +3278,7 @@ begin Result := Result + NewLine + Space + CustomMessage('SummaryStartioBroker') + ' ' + Format(CustomMessage('Service'), [iobServiceName]); - if expertCB.Checked and exoNewServerRB.Checked and optInstallIoBrokerCB.Checked or optDataMigrationCB.Checked then begin + if expertCB.Checked and exoNewServerRB.Checked and optInstallIoBrokerCB.Checked and not isIobUpdate or optDataMigrationCB.Checked then begin Result := Result + NewLine + Space + CustomMessage('SummaryShutdownBroker') + ' ' + Format(CustomMessage('Service'), [iobServiceName]); if optDataMigrationCB.Checked then begin Result := Result + NewLine + Space + Format(CustomMessage('CopyMigrationDataFrom'), [optDataMigrationLabel.Caption]); diff --git a/build/windows/language/dutch.txt b/build/windows/language/dutch.txt index be1589c..77e44b1 100644 --- a/build/windows/language/dutch.txt +++ b/build/windows/language/dutch.txt @@ -147,3 +147,11 @@ dutch.CheckingForUpdates=Controleren op updates ... dutch.DownloadingInstaller=Installer %s downloaden ... dutch.StartInstaller=Installer %s is gedownload en wordt nu gestart. dutch.InstallerUpdateFailed=Er is iets misgegaan om onbekende redenen [%d]%n%nioBroker-installatie wordt voortgezet zonder installateur-update ... +dutch.IoBrokerNewest=Nieuwste beschikbare ioBroker-versie (JS-controller): %d.%d.%d +dutch.IoBrokerNewestNewer=Nieuwe ioBroker-versie (JS-controller) beschikbaar: %d.%d.%d +dutch.IoBrokerNewestOK=ioBroker (JS-controller) is up-to-date! +dutch.IoBrokerNewestNotFound=Nieuwste JS-controller-versie kon niet worden vastgesteld! +dutch.InstallIoBrokerUpdate=Update ioBroker (JS-controller) van versie %d.%d.%d naar %d.%d.%d +dutch.SummaryInstallIoBrokerUpdate=ioBroker (JS-controller) zal worden bijgewerkt van versie %d.%d.%d naar %d.%d.%d +dutch.UpdatingIoBroker=JS-controller bijwerken van versie %d.%d.%d naar %d.%d.%d ... +dutch.UpdatingFailedIoBroker=ioBroker bijwerken is mislukt. Na het klikken op OK wordt het logbestand weergegeven. Controleer het en zoek de reden voor de mislukking. Het installatieprogramma wordt gesloten. diff --git a/build/windows/language/english.txt b/build/windows/language/english.txt index 40c156a..913b161 100644 --- a/build/windows/language/english.txt +++ b/build/windows/language/english.txt @@ -147,3 +147,11 @@ english.CheckingForUpdates=Checking for updates ... english.DownloadingInstaller=Downloading Installer %s ... english.StartInstaller=Installer %s has been downloaded and is now being launched. english.InstallerUpdateFailed=Something went wrong for unknown reasons [%d]%n%nioBroker installation will continue without Installer update ... +english.IoBrokerNewest=Newest available ioBroker version (JS-Controller): %d.%d.%d +english.IoBrokerNewestNewer=New ioBroker version (JS-Controller) available: %d.%d.%d +english.IoBrokerNewestOK=ioBroker (JS-Controller) is up to date! +english.IoBrokerNewestNotFound=Newest JS-Controller version could not be determined! +english.InstallIoBrokerUpdate=Update ioBroker (JS-Controller) from version %d.%d.%d to %d.%d.%d +english.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) will be updated from version %d.%d.%d to %d.%d.%d +english.UpdatingIoBroker=Updating JS-Controller from version %d.%d.%d to %d.%d.%d ... +english.UpdatingFailedIoBroker=Updating ioBroker failed. After clicking OK the logfile will be displayed. Check it and find the reason for the failure. The installer will be closed. diff --git a/build/windows/language/french.txt b/build/windows/language/french.txt index 89758d4..4936b06 100644 --- a/build/windows/language/french.txt +++ b/build/windows/language/french.txt @@ -147,3 +147,11 @@ french.CheckingForUpdates=V french.DownloadingInstaller=Tlchargement de l'installateur %s ... french.StartInstaller=L'installateur %s a t tlcharg et est maintenant en cours de lancement. french.InstallerUpdateFailed=Quelque chose s'est mal pass pour des raisons inconnues [%d]%n%nL'installation de ioBroker se poursuivra sans mise jour de l'installateur ... +french.IoBrokerNewest=Nouvelle version la plus rcente d'ioBroker (JS-Controller) disponible : %d.%d.%d +french.IoBrokerNewestNewer=Nouvelle version d'ioBroker (JS-Controller) disponible : %d.%d.%d +french.IoBrokerNewestOK=ioBroker (JS-Controller) est jour ! +french.IoBrokerNewestNotFound=Impossible de dterminer la dernire version de JS-Controller ! +french.InstallIoBrokerUpdate=Mettre jour ioBroker (JS-Controller) de la version %d.%d.%d %d.%d.%d +french.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) sera mis jour de la version %d.%d.%d %d.%d.%d +french.UpdatingIoBroker=Mise jour de JS-Controller de la version %d.%d.%d %d.%d.%d en cours ... +french.UpdatingFailedIoBroker=La mise jour d'ioBroker a chou. Aprs avoir cliqu sur OK, le fichier journal sera affich. Vrifiez-le et trouvez la raison de l'chec. L'installateur sera ferm. diff --git a/build/windows/language/german.txt b/build/windows/language/german.txt index 9b88a4c..54b3027 100644 --- a/build/windows/language/german.txt +++ b/build/windows/language/german.txt @@ -147,3 +147,11 @@ german.CheckingForUpdates=Suche nach Aktualisierungen ... german.DownloadingInstaller=Lade Installer %s herunter ... german.StartInstaller=Installer %s wurde heruntergeladen und wird jetzt gestartet. german.InstallerUpdateFailed=Etwas ist aus unbekannten Grnden schief gelaufen [%d]%n%nDie ioBroker Installation wird nun ohne Installer Aktualisierung fortgesetzt ... +german.IoBrokerNewest=Neueste verfgbare ioBroker-Version (JS-Controller): %d.%d.%d +german.IoBrokerNewestNewer=Neue ioBroker-Version (JS-Controller) verfgbar: %d.%d.%d +german.IoBrokerNewestOK=ioBroker (JS-Controller) ist auf dem neuesten Stand! +german.IoBrokerNewestNotFound=Die neueste JS-Controller-Version konnte nicht ermittelt werden! +german.InstallIoBrokerUpdate=ioBroker (JS-Controller) aktualisieren von Version %d.%d.%d auf %d.%d.%d +german.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) wird von Version %d.%d.%d auf %d.%d.%d aktualisiert +german.UpdatingIoBroker=Aktualisiere JS-Controller von Version %d.%d.%d auf %d.%d.%d ... +german.UpdatingFailedIoBroker=Aktualisierung von ioBroker fehlgeschlagen. Wenn Du auf OK klickst, wird das Log file angezeigt. Bitte berprfe es und beseitige die Ursache fr das Installationsproblem. Der ioBroker Installer wird beendet. diff --git a/build/windows/language/italian.txt b/build/windows/language/italian.txt index 1930f1d..795957c 100644 --- a/build/windows/language/italian.txt +++ b/build/windows/language/italian.txt @@ -147,3 +147,11 @@ italian.CheckingForUpdates=Controllo degli aggiornamenti in corso ... italian.DownloadingInstaller=Download dell'installatore %s in corso ... italian.StartInstaller=L'installatore %s stato scaricato ed ora in fase di avvio. italian.InstallerUpdateFailed=Qualcosa andato storto per motivi sconosciuti [%d]%n%nL'installazione di ioBroker continuer senza l'aggiornamento dell'installatore ... +italian.IoBrokerNewest=Versione pi recente disponibile di ioBroker (JS-Controller): %d.%d.%d +italian.IoBrokerNewestNewer=Nuova versione di ioBroker (JS-Controller) disponibile: %d.%d.%d +italian.IoBrokerNewestOK=ioBroker (JS-Controller) aggiornato! +italian.IoBrokerNewestNotFound=Impossibile determinare la versione pi recente di JS-Controller! +italian.InstallIoBrokerUpdate=Aggiorna ioBroker (JS-Controller) dalla versione %d.%d.%d a %d.%d.%d +italian.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) verr aggiornato dalla versione %d.%d.%d a %d.%d.%d +italian.UpdatingIoBroker=Aggiornamento JS-Controller dalla versione %d.%d.%d a %d.%d.%d ... +italian.UpdatingFailedIoBroker=Aggiornamento di ioBroker non riuscito. Dopo aver fatto clic su OK verr visualizzato il file di registro. Controllalo e trova il motivo del fallimento. Il programma di installazione verr chiuso. diff --git a/build/windows/language/polish.txt b/build/windows/language/polish.txt index b855e72..786be28 100644 --- a/build/windows/language/polish.txt +++ b/build/windows/language/polish.txt @@ -147,3 +147,11 @@ polish.CheckingForUpdates=Sprawdzanie aktualizacji ... polish.DownloadingInstaller=Pobieranie instalatora %s ... polish.StartInstaller=Instalator %s został pobrany i jest teraz uruchamiany. polish.InstallerUpdateFailed=Coś poszło nie tak z nieznanych powodów [%d]%n%nInstalacja ioBroker będzie kontynuowana bez aktualizacji instalatora ... +polish.IoBrokerNewest=Najnowsza dostępna wersja ioBrokera (JS-Controller): %d.%d.%d +polish.IoBrokerNewestNewer=Nowa wersja ioBrokera (JS-Controller) dostępna: %d.%d.%d +polish.IoBrokerNewestOK=ioBroker (JS-Controller) jest aktualny! +polish.IoBrokerNewestNotFound=Nie można określić najnowszej wersji JS-Controllera! +polish.InstallIoBrokerUpdate=Aktualizuj ioBrokera (JS-Controller) z wersji %d.%d.%d do %d.%d.%d +polish.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) zostanie zaktualizowany z wersji %d.%d.%d do %d.%d.%d +polish.UpdatingIoBroker=Aktualizowanie JS-Controllera z wersji %d.%d.%d do %d.%d.%d ... +polish.UpdatingFailedIoBroker=Aktualizacja ioBrokera nie powiodła się. Po kliknięciu przycisku OK zostanie wyświetlony plik dziennika. Sprawdź go i znajdź przyczynę niepowodzenia. Instalator zostanie zamknięty. diff --git a/build/windows/language/portuguese.txt b/build/windows/language/portuguese.txt index 3a6daf8..f3887ad 100644 --- a/build/windows/language/portuguese.txt +++ b/build/windows/language/portuguese.txt @@ -147,3 +147,11 @@ portuguese.CheckingForUpdates=Verificando atualizações ... portuguese.DownloadingInstaller=Baixando o instalador %s ... portuguese.StartInstaller=O instalador %s foi baixado e está sendo iniciado agora. portuguese.InstallerUpdateFailed=Algo deu errado por razões desconhecidas [%d]%n%nA instalação do ioBroker continuará sem a atualização do instalador ... +portuguese.IoBrokerNewest=Versão mais recente do ioBroker disponível (JS-Controller): %d.%d.%d +portuguese.IoBrokerNewestNewer=Nova versão do ioBroker (JS-Controller) disponível: %d.%d.%d +portuguese.IoBrokerNewestOK=ioBroker (JS-Controller) está atualizado! +portuguese.IoBrokerNewestNotFound=Não foi possível determinar a versão mais recente do JS-Controller! +portuguese.InstallIoBrokerUpdate=Atualizar ioBroker (JS-Controller) da versão %d.%d.%d para %d.%d.%d +portuguese.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) será atualizado da versão %d.%d.%d para %d.%d.%d +portuguese.UpdatingIoBroker=Atualizando JS-Controller da versão %d.%d.%d para %d.%d.%d ... +portuguese.UpdatingFailedIoBroker=A atualização do ioBroker falhou. Após clicar em OK, o arquivo de log será exibido. Verifique e encontre o motivo da falha. O instalador será fechado. diff --git a/build/windows/language/russian.txt b/build/windows/language/russian.txt index 5490df8..4217fcb 100644 --- a/build/windows/language/russian.txt +++ b/build/windows/language/russian.txt @@ -147,3 +147,11 @@ russian.CheckingForUpdates=Проверка обновлений ... russian.DownloadingInstaller=Загрузка установщика %s ... russian.StartInstaller=Установщик %s был загружен и теперь запускается. russian.InstallerUpdateFailed=Что-то пошло не так по неизвестным причинам [%d]%n%nУстановка ioBroker будет продолжена без обновления установщика ... +russian.IoBrokerNewest=Новейшая доступная версия ioBroker (JS-Controller): %d.%d.%d +russian.IoBrokerNewestNewer=Доступна новая версия ioBroker (JS-Controller): %d.%d.%d +russian.IoBrokerNewestOK=ioBroker (JS-Controller) обновлен! +russian.IoBrokerNewestNotFound=Не удалось определить новейшую версию JS-Controller! +russian.InstallIoBrokerUpdate=Обновить ioBroker (JS-Controller) с версии %d.%d.%d до %d.%d.%d +russian.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) будет обновлен с версии %d.%d.%d до %d.%d.%d +russian.UpdatingIoBroker=Обновление JS-Controller с версии %d.%d.%d до %d.%d.%d ... +russian.UpdatingFailedIoBroker=Обновление ioBroker не удалось. После нажатия OK будет отображен файл журнала. Проверьте его и найдите причину сбоя. Установщик будет закрыт. diff --git a/build/windows/language/spanish.txt b/build/windows/language/spanish.txt index 54fdab4..7ac09f4 100644 --- a/build/windows/language/spanish.txt +++ b/build/windows/language/spanish.txt @@ -147,3 +147,11 @@ spanish.CheckingForUpdates=Comprobando actualizaciones ... spanish.DownloadingInstaller=Descargando el instalador %s ... spanish.StartInstaller=El instalador %s se ha descargado y ahora se est iniciando. spanish.InstallerUpdateFailed=Algo sali mal por razones desconocidas [%d]%n%nLa instalacin de ioBroker continuar sin la actualizacin del instalador ... +spanish.IoBrokerNewest=Nueva versin disponible de ioBroker (JS-Controller): %d.%d.%d +spanish.IoBrokerNewestNewer=Nueva versin de ioBroker (JS-Controller) disponible: %d.%d.%d +spanish.IoBrokerNewestOK=ioBroker (JS-Controller) est actualizado! +spanish.IoBrokerNewestNotFound=No se pudo determinar la versin ms reciente de JS-Controller! +spanish.InstallIoBrokerUpdate=Actualizar ioBroker (JS-Controller) desde la versin %d.%d.%d hasta %d.%d.%d +spanish.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) se actualizar desde la versin %d.%d.%d hasta %d.%d.%d +spanish.UpdatingIoBroker=Actualizando JS-Controller desde la versin %d.%d.%d hasta %d.%d.%d ... +spanish.UpdatingFailedIoBroker=La actualizacin de ioBroker fall. Despus de hacer clic en Aceptar se mostrar el archivo de registro. Revsalo y encuentra la razn del fallo. El instalador se cerrar. diff --git a/build/windows/language/ukrainian.txt b/build/windows/language/ukrainian.txt index 8a30cc8..0cfc5c9 100644 --- a/build/windows/language/ukrainian.txt +++ b/build/windows/language/ukrainian.txt @@ -147,3 +147,11 @@ ukrainian.CheckingForUpdates=Перевірка оновлень ... ukrainian.DownloadingInstaller=Завантаження установника %s ... ukrainian.StartInstaller=Установник %s був завантажений і зараз запускається. ukrainian.InstallerUpdateFailed=Щось пішло не так з невідомих причин [%d]%n%nІнсталяція ioBroker буде продовжена без оновлення установника ... +ukrainian.IoBrokerNewest=Найновіша доступна версія ioBroker (JS-Controller): %d.%d.%d +ukrainian.IoBrokerNewestNewer=Доступна нова версія ioBroker (JS-Controller): %d.%d.%d +ukrainian.IoBrokerNewestOK=ioBroker (JS-Controller) оновлено! +ukrainian.IoBrokerNewestNotFound=Не вдалося визначити найновішу версію JS-Controller! +ukrainian.InstallIoBrokerUpdate=Оновити ioBroker (JS-Controller) з версії %d.%d.%d на %d.%d.%d +ukrainian.SummaryInstallIoBrokerUpdate=ioBroker (JS-Controller) буде оновлено з версії %d.%d.%d на %d.%d.%d +ukrainian.UpdatingIoBroker=Оновлення JS-Controller з версії %d.%d.%d на %d.%d.%d ... +ukrainian.UpdatingFailedIoBroker=Оновлення ioBroker не вдалося. Після натискання кнопки OK буде відображений файл журналу. Перевірте його і знайдіть причину невдачі. Інсталятор буде закритий. From 87ee4a5f991a060b28aa1797967d88441b6e3e17 Mon Sep 17 00:00:00 2001 From: Gaspode69 <45949835+Gaspode69@users.noreply.github.com> Date: Wed, 8 May 2024 17:43:33 +0200 Subject: [PATCH 3/5] Make JS-Controller version detection more robust --- build/windows/ioBroker.iss | 84 +++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 20 deletions(-) diff --git a/build/windows/ioBroker.iss b/build/windows/ioBroker.iss index 9e19f97..6e06826 100644 --- a/build/windows/ioBroker.iss +++ b/build/windows/ioBroker.iss @@ -844,6 +844,24 @@ begin Result := appInstPath + '\log\installIoBrokerFix.log'; end; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +function getLogNameIoBroker: String; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +begin + Result := getLogNameIoBrokerUpdate; + if optInstallIoBrokerCB.Checked then begin + if not isIobUpdate then begin + Result := getLogNameIoBrokerInstall; + end; + end + else begin + if optFixIoBrokerCB.Checked then begin + Result := getLogNameIoBrokerFix + end + end; + Log('Log file: ' + Result); +end; + {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Callbacks for downloads ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -933,8 +951,6 @@ begin end; end; - - {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} function getPortInfo(port: Integer): String; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} @@ -944,7 +960,7 @@ begin end; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} -function checkIoBrokerRunning(info: String): Boolean; +function checkIoBrokerRunning(info: String; logName: String): Boolean; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} var iobServiceOK: Boolean; @@ -953,19 +969,23 @@ var begin Result := False; marqueePage.SetText(info, CustomMessage('WaitForService')); + SaveStringToFile(logName, 'Waiting for ioBroker service ...' + chr(13) + chr(10), True); for i := 0 to 15 do begin Sleep(1000); iobServiceOK := isIobServiceRunning(iobServiceName); if iobServiceOK then break; end; if iobServiceOK then begin + Log('ioBroker service started!'); + SaveStringToFile(logName, 'ioBroker service ' + iobServiceName + ' started! ---> OK' + chr(13) + chr(10), True); + // If Node.js was not installed at the beginning, the Admin port is probably 0. // In this case we try to fetch it again: + SaveStringToFile(logName, 'Waiting for ioBroker Admin ...' + chr(13) + chr(10), True); if iobAdminPort = 0 then begin if nodepath = '' then gatherInstNodeData; iobAdminPort := getIobAdminPort(appInstPath); end; - Log('ioBroker service was started!'); marqueePage.SetText(info, CustomMessage('WaitForAdmin')); for i := 0 to 100 do begin Sleep(500); @@ -974,14 +994,17 @@ begin end; if portInfo <> '' then begin Log('ioBroker Admin is reachable!'); + SaveStringToFile(logName, Format('ioBroker Admin is reachable on port %d! ---> OK', [iobAdminPort]) + chr(13) + chr(10), True); Result := True; end else begin - Log('ioBroker Admin is not reachable!'); + Log('ioBroker Admin is not reachable (timeout)!'); + SaveStringToFile(logName, 'ioBroker Admin is not reachable (timeout)!' + chr(13) + chr(10), True); end end else begin - Log('ioBroker service was not started!'); + Log('ioBroker service not started (timeout)!'); + SaveStringToFile(logName, 'ioBroker service ' + iobServiceName + ' not started (timeout)!' + chr(13) + chr(10), True); end; end; @@ -1026,7 +1049,7 @@ begin ioBrokerEx := appInstPath + '\node_modules\iobroker.js-controller/iobroker.js'; versionString := execAndReturnOutput('"' + nodeJsEx + '" "' + ioBrokerEx + '" update | find "Controller ""js-controller"":"', True, nodePath, ''); if (versionString <> '') then begin - curPos := 29; // |Controller "js-controller": | + curPos := pos('Controller "js-controller": ', versionString) + 28; versionString := Trim(Copy(versionString, curPos, Length(versionString) - curPos)); curPos := pos(' ', versionString); if (curPos > 0) then begin @@ -2516,7 +2539,7 @@ function installIoBroker: Boolean; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} var cmd: String; - LogName: String; + logName: String; info: String; output: String; majorV: Integer; @@ -2525,7 +2548,7 @@ var begin result := False; cmd := ''; - LogName := '' + logName := '' info := ''; if expertCB.Checked and exoNewServerRB.Checked then begin @@ -2536,6 +2559,8 @@ begin end; end; + logName := getLogNameIoBroker; + if optInstallIoBrokerCB.Checked then begin if iobServiceExists and not isIobUpdate then begin // Service exists, but ioBroker not installed. We remove the Service @@ -2546,12 +2571,10 @@ begin gatherInstNodeData; if isIobUpdate then begin cmd := '"' + nodePath + '\node.exe" "' + appInstPath + '\node_modules\iobroker.js-controller/iobroker.js" upgrade self'; - LogName := getLogNameIoBrokerUpdate; info := Format(CustomMessage('UpdatingIoBroker'), [iobVersionMajor, iobVersionMinor, iobVersionPatch, iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch]); end else begin cmd := '"' + nodePath + '\npx" --yes @iobroker/install@latest'; - LogName := getLogNameIoBrokerInstall; info := CustomMessage('InstallingIoBroker'); end; end @@ -2559,7 +2582,6 @@ begin if optFixIoBrokerCB.Checked then begin gatherInstNodeData; cmd := '"' + nodePath + '\npx" --yes @iobroker/fix@latest'; - LogName := getLogNameIoBrokerFix info := CustomMessage('FixingIoBroker'); end end; @@ -2570,36 +2592,54 @@ begin marqueePage.Show marqueePage.Animate - fixPrefixPath(LogName); + fixPrefixPath(logName); // ioBroker.bat makes trouble when calling npx@iobroker..., delete it // Don't panic, fix will restore it anyway, and install will install it anyway DeleteFile(appInstPath + '\iobroker.bat'); - if execAndStoreOutput(cmd , LogName, nodePath, appInstPath) then begin + if execAndStoreOutput(cmd , logName, nodePath, appInstPath) then begin if isIobUpdate then begin // In this case no instDone file is created, we have to verify the success in another way: gatherNewestIoBrokerVersion(majorV, minorV, patchV); Result := compareVersions(iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch, majorV, minorV, patchV) = 0; + Log('ioBroker JS-Controller update done!'); + SaveStringToFile(logName, + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10) + + 'JS-Controller Update done.' + chr(13) + chr(10) + + Format('Verification: Latest JS-Controller: %d.%d.%d, installed: %d.%d.%d', [iobVersionNewMajor, iobVersionNewMinor, iobVersionNewPatch, majorV, minorV, patchV]) + chr(13) + chr(10) + + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10), True); end else begin if (FileExists(appInstPath + '\instDone')) then begin if expertCB.Checked and exoNewServerRB.Checked and optInstallIoBrokerCB.Checked or optDataMigrationCB.Checked then begin - Result := reconfigureIoBroker(info, LogName); + Result := reconfigureIoBroker(info, logName); if not Result then begin MsgBox(CustomMessage('ReconfigureError'), mbError, MB_OK or MB_SETFOREGROUND); Exit; end; end; Log('ioBroker installation/fixing completed!'); - Result := checkIoBrokerRunning(info); + SaveStringToFile(logName, + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10) + + 'ioBroker installation/fixing completed!' + chr(13) + chr(10) + + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10), True); + Result := checkIoBrokerRunning(info, logName); end else begin Log('ioBroker installation/fixing did not run til the end!'); + SaveStringToFile(logName, + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10) + + 'ioBroker installation/fixing was not completed properly!' + chr(13) + chr(10) + + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10), True); end; end; end else begin Log('ioBroker installation/fixing was not executed due to unknown error!'); + SaveStringToFile(logName, + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10) + + 'ioBroker installation/fixing: Unknown error occurred!' + chr(13) + chr(10) + + '----------------------------------------------------------------------------------------------------' + chr(13) + chr(10), True); end; except @@ -3014,6 +3054,7 @@ var output: String; cont: Boolean; resultCode: Integer; + logName: String; begin if CurStep = ssInstall then begin if expertCB.Checked and exoUninstallServerRB.Checked then begin @@ -3078,6 +3119,7 @@ begin end; end else begin + logName := getLogNameIoBroker; if optDataMigrationCB.Checked then begin MsgBox(CustomMessage('MigrationHints'), mbInformation, MB_OK or MB_SETFOREGROUND); end; @@ -3119,16 +3161,16 @@ begin if optInstallIoBrokerCB.Checked then begin if isIobUpdate then begin MsgBox(CustomMessage('UpdatingFailedIoBroker'), mbError, MB_OK or MB_SETFOREGROUND); - Exec('notepad', getLogNameIoBrokerUpdate, '', SW_SHOWNORMAL, ewNoWait, resultCode); + Exec('notepad', logName, '', SW_SHOWNORMAL, ewNoWait, resultCode); end else begin MsgBox(CustomMessage('InstallationFailedIoBroker'), mbError, MB_OK or MB_SETFOREGROUND); - Exec('notepad', getLogNameIoBrokerInstall, '', SW_SHOWNORMAL, ewNoWait, resultCode); + Exec('notepad', logName, '', SW_SHOWNORMAL, ewNoWait, resultCode); end; end else begin MsgBox(CustomMessage('InstallationFailedIoBrokerFix'), mbError, MB_OK or MB_SETFOREGROUND); - Exec('notepad', getLogNameIoBrokerFix, '', SW_SHOWNORMAL, ewNoWait, resultCode); + Exec('notepad', logName, '', SW_SHOWNORMAL, ewNoWait, resultCode); end; cont := False; end; @@ -3163,9 +3205,11 @@ begin // In this case ioBroker was not started automatically, restart ioBroker // After installation and fix the service is started anyway + SaveStringToFile(logName, 'Starting ioBroker service ...' + chr(13) + chr(10), True); output := execAndReturnOutput('sc start ' + iobServiceName + '.exe', False, '', ''); + SaveStringToFile(logName, 'Result: ' + output + chr(13) + chr(10), True); Log('Start ioBroker service:' + output); - cont := checkIoBrokerRunning(CustomMessage('StartIoBroker')); + cont := checkIoBrokerRunning(CustomMessage('StartIoBroker'), logName); except cont := False; finally From 145bacf35811d35e87f2c9f7ed8e8440be5409b4 Mon Sep 17 00:00:00 2001 From: Gaspode69 <45949835+Gaspode69@users.noreply.github.com> Date: Fri, 17 May 2024 08:45:40 +0200 Subject: [PATCH 4/5] Update version no. to 3.1.0 --- README.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a5d3a0b..f7426f4 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,11 @@ Pre-requires: ## Changelog -### **WORK IN PROGRESS** +# 3.1.0 (17.05.2024) (Gaspode) Logging enhanced (Gaspode) Fixed: Checking Admin port after installation fails if Node.js was not installed when the installation started -(Gaspode) Update/Upgrade of JS-Controller implemented - +(Gaspode) Update/Upgrade of JS-Controller implemented # 3.0.1 (25.02.2024) diff --git a/package.json b/package.json index ed3135c..4426090 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.build", - "version": "3.0.1", + "version": "3.1.0", "repository": { "type": "git", "url": "https://github.com/ioBroker/ioBroker.build.git" From b02e3b1ca6b375b86ce11f000156fb468d746bed Mon Sep 17 00:00:00 2001 From: Gaspode69 <45949835+Gaspode69@users.noreply.github.com> Date: Sun, 19 May 2024 10:22:42 +0200 Subject: [PATCH 5/5] Bugfix: Set Admin port in expert mode failed in rare cases --- README.md | 3 ++- build/windows/ioBroker.iss | 47 +++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7426f4..ed46ab3 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,10 @@ Pre-requires: # 3.1.0 (17.05.2024) +(Gaspode) Update/Upgrade of JS-Controller implemented (Gaspode) Logging enhanced (Gaspode) Fixed: Checking Admin port after installation fails if Node.js was not installed when the installation started -(Gaspode) Update/Upgrade of JS-Controller implemented +(Gaspode) Fixed: Set Admin port in expert mode failed in rare cases # 3.0.1 (25.02.2024) diff --git a/build/windows/ioBroker.iss b/build/windows/ioBroker.iss index 6e06826..febb8a0 100644 --- a/build/windows/ioBroker.iss +++ b/build/windows/ioBroker.iss @@ -33,6 +33,7 @@ ; - 07.05.2024 Gaspode: Fixed: Checking Admin port after installation fails if Node.js was not - ; installed when the installation started - ; - 07.05.2024 Gaspode: Update/Upgrade of JS-Controller implemented - +; - 19.05.2024 Gaspode: Fixed: Set Admin port in expert mode failed in rare cases - ; - - ; ---------------------------------------------------------------------------------------------- #define MyAppName "ioBroker automation platform" @@ -908,6 +909,25 @@ begin Result := pos('RUNNING', statusString) > 0; end; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +function isIobServiceStopped(serviceName: String): boolean; +{--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} +var + statusString: String; + retryCount: Integer; +begin + Result := False; + retryCount := 0; + while (not Result and (retryCount < 20)) do begin + Log(Format('Check if ioBroker Service Status: %s is stopped (try: %d).', [serviceName, retryCount+1])); + statusString := execAndReturnOutput('sc query ' + serviceName + '.exe', True, '', ''); + Log(Format('ioBroker Service Status: %s', [statusString])); + Result := pos('STOPPED', statusString) > 0; + Sleep(1000); + retryCount := retryCount + 1; + end; +end; + {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------} procedure createPortBatch; @@ -2674,10 +2694,26 @@ begin 'Stop service ' + serviceName + '.exe:' + chr(13) + chr(10) + output + chr(13) + chr(10), True); end; + Sleep(2000); - if not isIobServiceRunning(serviceName) then begin + + if isIobServiceStopped(serviceName) then begin + saveStringToFile(logFileName,'Service stopped!' + chr(13) + chr(10), True); Result := True; Exit; + end + else begin + saveStringToFile(logFileName,'Service not stopped! Try again.' + chr(13) + chr(10), True); + output := execAndReturnOutput('sc stop ' + serviceName + '.exe', True, '', ''); + Sleep(5000); + if isIobServiceStopped(serviceName) then begin + saveStringToFile(logFileName,'Service stopped! + chr(13) + chr(10)', True); + Result := True; + Exit; + end + else begin + saveStringToFile(logFileName,'Service not stopped! Try to kill processes.' + chr(13) + chr(10), True); + end; end; end; @@ -3881,7 +3917,9 @@ function reconfigureIoBrokerAdminPort(adminPort: Integer; logFileName: String): var cmd: String; resultStr: String; + newAdminPort: Integer; begin + Sleep(2000); Result := True; cmd := '"' + nodePath + '\node.exe" "' + appInstPath + '\node_modules\iobroker.js-controller/iobroker.js" set admin.0 --port ' + Format('%d', [adminPort]); Log (cmd); @@ -3892,6 +3930,13 @@ begin '----------------------------------------------' + chr(13) + chr(10) + 'reconfigureIoBrokerAdminPort:' + chr(13) + chr(10) + resultStr + chr(13) + chr(10), True); + + Sleep(2000); + newAdminPort := getIobAdminPort(appInstPath); + Log(Format('New Admin Port = %d', [newAdminPort])); + SaveStringToFile(logFileName, + Format('New Admin Port = %d', [newAdminPort]) + chr(13) + chr(10), True); + end; {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------}