EvanZhu0721 / 公开仓库
SBMS
SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.
installer/SBMS.iss6.2 KB
1
#define AppName "SBMS"2
#ifndef AppVersion3
#define AppVersion "0.0.0-dev"4
#endif5
#ifndef OutputSuffix6
#define OutputSuffix ""7
#endif8
#define AppPublisher "SBMS"9
#define AppExeName "sbms-tray.exe"10
11
[Setup]12
AppId={{7EB4D7A8-16A9-4B6F-82E3-31A77BC81B6A}13
AppName={#AppName}14
AppVersion={#AppVersion}15
AppPublisher={#AppPublisher}16
DefaultDirName={autopf64}\SBMS17
DefaultGroupName=SBMS18
DisableProgramGroupPage=yes19
ArchitecturesAllowed=x64compatible20
ArchitecturesInstallIn64BitMode=x64compatible21
PrivilegesRequired=admin22
OutputDir=..\target\installer23
OutputBaseFilename=SBMS-Setup-{#AppVersion}-x64{#OutputSuffix}24
Compression=lzma225
SolidCompression=yes26
WizardStyle=modern27
UninstallDisplayIcon={app}\{#AppExeName}28
CloseApplications=no29
RestartApplications=no30
ChangesEnvironment=no31
SetupLogging=yes32
#ifndef UnsignedBuild33
SignTool=sbmssign34
SignedUninstaller=yes35
#endif36
37
[Files]38
Source: "..\target\release\sbms.exe"; DestDir: "{app}"; Flags: ignoreversion39
Source: "..\target\release\sbms-tray.exe"; DestDir: "{app}"; Flags: ignoreversion40
Source: "..\target\driver\SBMSIndirectDisplay.inf"; DestDir: "{app}\driver"; Flags: ignoreversion41
Source: "..\target\driver\SBMSIndirectDisplay.dll"; DestDir: "{app}\driver"; Flags: ignoreversion42
Source: "..\target\driver\SBMSIndirectDisplay.cat"; DestDir: "{app}\driver"; Flags: ignoreversion43
Source: "maintenance.ps1"; DestDir: "{app}\installer"; Flags: ignoreversion44
Source: "manage-sunshine-instance.ps1"; DestDir: "{app}\installer"; Flags: ignoreversion45
Source: "..\NOTICE.md"; DestDir: "{app}\licenses"; Flags: ignoreversion46
Source: "..\LICENSE"; DestDir: "{app}\licenses"; DestName: "GPL-3.0.txt"; Flags: ignoreversion47
Source: "..\LICENSES\MS-PL.txt"; DestDir: "{app}\licenses"; Flags: ignoreversion48
Source: "..\LICENSES\Apache-2.0.txt"; DestDir: "{app}\licenses"; Flags: ignoreversion49
Source: "maintenance.ps1"; DestName: "sbms-maintenance.ps1"; Flags: dontcopy50
51
[InstallDelete]52
; User state under {localappdata}\SBMS is intentionally preserved during upgrades.53
Type: files; Name: "{app}\diagnose-sbms.ps1"54
Type: files; Name: "{app}\install-sbms-driver.ps1"55
Type: files; Name: "{app}\install-sbms-program-files.ps1"56
Type: files; Name: "{app}\README.md"57
Type: files; Name: "{app}\RELEASE_NOTES.md"58
Type: files; Name: "{app}\run-sbms-native.ps1"59
Type: files; Name: "{app}\SBMSDeviceHost.exe"60
Type: files; Name: "{app}\SBMSNative.exe"61
Type: files; Name: "{app}\SBMSSetup.exe"62
Type: files; Name: "{app}\driver\IddSampleDriver.cer"63
Type: filesandordirs; Name: "{app}\driver\IddSampleDriver"64
65
[UninstallDelete]66
; A deliberate uninstall removes configuration, display overrides, and diagnostics.67
Type: filesandordirs; Name: "{localappdata}\SBMS"68
Type: files; Name: "{app}\diagnose-sbms.ps1"69
Type: files; Name: "{app}\install-sbms-driver.ps1"70
Type: files; Name: "{app}\install-sbms-program-files.ps1"71
Type: files; Name: "{app}\README.md"72
Type: files; Name: "{app}\RELEASE_NOTES.md"73
Type: files; Name: "{app}\run-sbms-native.ps1"74
Type: files; Name: "{app}\SBMSDeviceHost.exe"75
Type: files; Name: "{app}\SBMSNative.exe"76
Type: files; Name: "{app}\SBMSSetup.exe"77
Type: files; Name: "{app}\driver\IddSampleDriver.cer"78
Type: filesandordirs; Name: "{app}\driver\IddSampleDriver"79
80
[Icons]81
Name: "{group}\SBMS"; Filename: "{app}\sbms-tray.exe"; Parameters: "--open"; WorkingDir: "{app}"82
Name: "{group}\Uninstall SBMS"; Filename: "{uninstallexe}"83
84
[Code]85
function PowerShellPath(): String;86
begin87
Result := ExpandConstant('{sys}\WindowsPowerShell\v1.0\powershell.exe');88
end;89
90
function RunMaintenanceScript(91
ScriptPath: String;92
Action: String;93
Root: String;94
var ResultCode: Integer): Boolean;95
var96
Parameters: String;97
begin98
if not FileExists(ScriptPath) then99
begin100
ResultCode := 2;101
Result := False;102
exit;103
end;104
Parameters :=105
'-NoLogo -NoProfile -NonInteractive -File "' + ScriptPath +106
'" -Action "' + Action + '" -InstallRoot "' + Root + '"';107
Result := Exec(108
PowerShellPath(),109
Parameters,110
'',111
SW_HIDE,112
ewWaitUntilTerminated,113
ResultCode);114
end;115
116
function RunMaintenance(Action: String; Root: String; var ResultCode: Integer): Boolean;117
begin118
Result := RunMaintenanceScript(119
AddBackslash(Root) + 'installer\maintenance.ps1',120
Action,121
Root,122
ResultCode);123
end;124
125
function PrepareToInstall(var NeedsRestart: Boolean): String;126
var127
ResultCode: Integer;128
ScriptPath: String;129
begin130
Result := '';131
if DirExists(ExpandConstant('{app}')) then132
begin133
ExtractTemporaryFile('sbms-maintenance.ps1');134
ScriptPath := ExpandConstant('{tmp}\sbms-maintenance.ps1');135
if not RunMaintenanceScript(136
ScriptPath,137
'PrepareUpgrade',138
ExpandConstant('{app}'),139
ResultCode) then140
Result := 'Could not start the SBMS upgrade preparation helper.'141
else if ResultCode <> 0 then142
Result := 'The existing SBMS session or configuration could not be preserved safely. Setup was cancelled.';143
end;144
end;145
146
procedure CurStepChanged(CurStep: TSetupStep);147
var148
ResultCode: Integer;149
begin150
if CurStep = ssPostInstall then151
begin152
if not RunMaintenance('Install', ExpandConstant('{app}'), ResultCode) then153
RaiseException('Could not start SBMS installation maintenance.')154
else if ResultCode <> 0 then155
RaiseException(Format('SBMS driver or startup registration failed (exit code %d).', [ResultCode]));156
end;157
end;158
159
function InitializeUninstall(): Boolean;160
var161
ResultCode: Integer;162
begin163
Result := RunMaintenance('PreflightUninstall', ExpandConstant('{app}'), ResultCode);164
if not Result then165
MsgBox('Could not start SBMS uninstall preflight.', mbError, MB_OK)166
else if ResultCode <> 0 then167
begin168
MsgBox(169
Format('SBMS uninstall preflight failed (exit code %d). No uninstall changes were started.', [ResultCode]),170
mbError,171
MB_OK);172
Result := False;173
end;174
end;175
176
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);177
var178
ResultCode: Integer;179
begin180
if CurUninstallStep = usUninstall then181
begin182
if not RunMaintenance('Uninstall', ExpandConstant('{app}'), ResultCode) then183
RaiseException('Could not start SBMS uninstall maintenance.')184
else if ResultCode <> 0 then185
RaiseException(186
Format('SBMS external cleanup failed or was only partially compensated (exit code %d). Application files were retained.', [ResultCode]));187
end;188
end;189