102 lines
4.8 KiB
Plaintext
102 lines
4.8 KiB
Plaintext
#define PortableRoot "D:\Ai-project\REA逆向\Agent-Workbench\.qa\desktop-install-2bb4814a-23c0-4cad-af21-65ac3876d6c4\owned-fault-1.14.0"
|
|
#define OutputRoot "D:\Ai-project\REA逆向\Agent-Workbench\.qa\desktop-install-2bb4814a-23c0-4cad-af21-65ac3876d6c4"
|
|
#define OutputName "owned-fault-1.14.0-Setup"
|
|
#define Version "1.14.0"
|
|
#define VersionDirectory "owned-fault-1.14.0"
|
|
[Setup]
|
|
AppId={{88dc3907-7dcc-4001-98fa-705eccfb9491}
|
|
AppName=Agent Workbench
|
|
AppVersion={#Version}
|
|
DefaultDirName={localappdata}\Programs\AgentWorkbench
|
|
DefaultGroupName=Agent Workbench QA 88dc3907-7dcc-4001-98fa-705eccfb9491
|
|
PrivilegesRequired=lowest
|
|
ArchitecturesAllowed=x64compatible
|
|
ArchitecturesInstallIn64BitMode=x64compatible
|
|
DisableProgramGroupPage=yes
|
|
UsePreviousAppDir=yes
|
|
OutputDir={#OutputRoot}
|
|
OutputBaseFilename={#OutputName}
|
|
SetupIconFile={#PortableRoot}\public\workbench-icon.ico
|
|
UninstallDisplayIcon={app}\AgentWorkbench.exe
|
|
Compression=lzma2/fast
|
|
SolidCompression=yes
|
|
CloseApplications=no
|
|
RestartApplications=no
|
|
ChangesAssociations=no
|
|
WizardStyle=modern
|
|
Uninstallable=yes
|
|
|
|
[Files]
|
|
Source: "{#PortableRoot}\runtime\node.exe"; DestName: "awb-install-node.exe"; Flags: dontcopy
|
|
Source: "{#PortableRoot}\dist-server\install-manager.mjs"; DestName: "awb-install-manager.mjs"; Flags: dontcopy
|
|
Source: "{#PortableRoot}\*"; DestDir: "{app}\versions\{#VersionDirectory}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
Source: "{#PortableRoot}\AgentWorkbench.exe"; DestDir: "{app}"; Flags: onlyifdoesntexist
|
|
|
|
[Icons]
|
|
Name: "{group}\Agent Workbench"; Filename: "{app}\AgentWorkbench.exe"
|
|
Name: "{userdesktop}\Agent Workbench"; Filename: "{app}\AgentWorkbench.exe"; Tasks: desktopicon
|
|
|
|
[Tasks]
|
|
Name: "desktopicon"; Description: "创建桌面快捷方式"; Flags: unchecked
|
|
|
|
[Run]
|
|
Filename: "{app}\AgentWorkbench.exe"; Description: "打开 Agent Workbench"; Flags: nowait postinstall skipifsilent; Check: WasActivated
|
|
|
|
[Code]
|
|
var DataRoot: String; Port: String; StageOnly: Boolean; Activated: Boolean;
|
|
|
|
function Quoted(Value: String): String;
|
|
begin
|
|
if (Pos('"', Value) > 0) or (Pos(#13, Value) > 0) or (Pos(#10, Value) > 0) then RaiseException('安装路径无效。');
|
|
Result := '"' + Value + '"';
|
|
end;
|
|
|
|
procedure LoadOptions;
|
|
begin
|
|
DataRoot := ExpandConstant('{param:DATA_ROOT|{localappdata}\AgentWorkbench}');
|
|
Port := ExpandConstant('{param:PORT|4318}');
|
|
StageOnly := ExpandConstant('{param:STAGE_ONLY|0}') = '1';
|
|
end;
|
|
|
|
function RunManager(Command: String; Candidate: Boolean): Boolean;
|
|
var Parameters: String; ExitCode: Integer;
|
|
begin
|
|
Parameters := Quoted(ExpandConstant('{tmp}\awb-install-manager.mjs')) + ' ' + Command +
|
|
' --install-root ' + Quoted(ExpandConstant('{app}')) + ' --data-root ' + Quoted(DataRoot) + ' --port ' + Quoted(Port);
|
|
if Candidate then Parameters := Parameters + ' --candidate-root ' + Quoted(ExpandConstant('{app}\versions\{#VersionDirectory}'));
|
|
if StageOnly then Parameters := Parameters + ' --stage-only';
|
|
Result := Exec(ExpandConstant('{tmp}\awb-install-node.exe'), Parameters, ExpandConstant('{tmp}'), SW_HIDE, ewWaitUntilTerminated, ExitCode) and (ExitCode = 0);
|
|
end;
|
|
|
|
function PrepareToInstall(var NeedsRestart: Boolean): String;
|
|
begin
|
|
LoadOptions;
|
|
ExtractTemporaryFile('awb-install-node.exe'); ExtractTemporaryFile('awb-install-manager.mjs');
|
|
if DirExists(ExpandConstant('{app}\versions\{#VersionDirectory}')) then begin
|
|
Result := '该独立版本目录已经存在。请保留原版本,使用新的安装候选。'; exit;
|
|
end;
|
|
if not RunManager('preflight', False) then Result := '安装预检未通过。请等待任务、审批与工具结束并关闭桌面窗口,保留后台执行宿主及原数据;端口和安装身份仍需核对。';
|
|
end;
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
begin
|
|
if CurStep = ssPostInstall then begin
|
|
{ Explicit owned QA fault, never included by the product packaging CLI. }
|
|
if not SaveStringToFile(ExpandConstant('{app}\versions\{#VersionDirectory}\dist-client\index.html'), 'owned-candidate-corruption', True) then RaiseException('QA fault injection failed');
|
|
if not RunManager('activate', True) then RaiseException('候选激活失败;已尝试恢复原安装指针和执行宿主。请保留 .installation 操作收据核对结果。');
|
|
Activated := not StageOnly;
|
|
end;
|
|
end;
|
|
|
|
function WasActivated: Boolean;
|
|
begin Result := Activated; end;
|
|
|
|
function InitializeUninstall: Boolean;
|
|
var ExitCode: Integer;
|
|
begin
|
|
{ The native bootstrap verifies the entire registered immutable release before
|
|
invoking its fixed uninstall manager. No installed script is executed first. }
|
|
Result := Exec(ExpandConstant('{app}\AgentWorkbench.exe'), '--hidden-window --uninstall-preflight', ExpandConstant('{app}'), SW_HIDE, ewWaitUntilTerminated, ExitCode) and (ExitCode = 0);
|
|
if not Result then MsgBox('卸载预检未通过。请先关闭桌面窗口并等待活动结束;原程序和用户数据保留。', mbError, MB_OK);
|
|
end;
|