Adds /FORCEUPGRADE command line parameter
Allows skipping the upgrade confirmation prompt by providing the `/FORCEUPGRADE` command line parameter. This enables unattended upgrades for automation scenarios.
This commit is contained in:
@@ -80,6 +80,20 @@ var
|
|||||||
PreviousVersion: String;
|
PreviousVersion: String;
|
||||||
IsUpgrade: Boolean;
|
IsUpgrade: Boolean;
|
||||||
|
|
||||||
|
// Check if a command line parameter exists
|
||||||
|
function CmdLineParamExists(const Param: string): Boolean;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
for I := 1 to ParamCount do
|
||||||
|
if CompareText(ParamStr(I), Param) = 0 then
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// Check if a previous version is installed
|
// Check if a previous version is installed
|
||||||
function GetPreviousVersion(): String;
|
function GetPreviousVersion(): String;
|
||||||
var
|
var
|
||||||
@@ -114,6 +128,9 @@ begin
|
|||||||
IsUpgrade := (PreviousVersion <> '');
|
IsUpgrade := (PreviousVersion <> '');
|
||||||
|
|
||||||
if IsUpgrade then
|
if IsUpgrade then
|
||||||
|
begin
|
||||||
|
// Check for /FORCEUPGRADE parameter to skip confirmation
|
||||||
|
if not CmdLineParamExists('/FORCEUPGRADE') then
|
||||||
begin
|
begin
|
||||||
// Show upgrade message
|
// Show upgrade message
|
||||||
Message := FmtMessage(CustomMessage('UpgradeDetected'), [PreviousVersion]) + #13#10#13#10 +
|
Message := FmtMessage(CustomMessage('UpgradeDetected'), [PreviousVersion]) + #13#10#13#10 +
|
||||||
@@ -124,6 +141,7 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Show appropriate welcome message
|
// Show appropriate welcome message
|
||||||
|
|||||||
Reference in New Issue
Block a user