Debian Codegraph @

misc/DisplayCAL-Setup-0install.iss

raw
1 ; Script generated by the Inno Setup Script Wizard.
2 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3
4 #include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','ScriptPath','')
5
6 [Setup]
7 ; NOTE: The value of AppId uniquely identifies this application.
8 ; Do not use the same AppId value in installers for other applications.
9 ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
10 AppID={{4714199A-0D66-4E69-97FF-7B54BFF80B88}
11 AppCopyright=%(AppCopyright)s
12 AppName=%(AppName)s
13 AppPublisher=%(AppPublisher)s
14 AppPublisherURL=%(AppPublisherURL)s
15 AppReadmeFile=%(URL)s
16 AppSupportURL=%(AppSupportURL)s
17 AppUpdatesURL=%(AppUpdatesURL)s
18 ArchitecturesInstallIn64BitMode=x64
19 ArchitecturesAllowed=x64
20 DefaultDirName={pf}\%(AppName)s
21 DefaultGroupName=%(AppName)s
22 LicenseFile=..\LICENSE.txt
23 OutputDir=.
24 OutputBaseFilename=%(AppName)s-0install-Setup
25 SetupIconFile=..\%(AppName)s\theme\icons\%(AppName)s.ico
26 Compression=lzma/Max
27 SolidCompression=true
28 VersionInfoVersion=%(VersionInfoVersion)s
29 VersionInfoDescription=%(AppName)s Setup
30 VersionInfoTextVersion=0install
31 WizardImageFile=..\misc\media\install.bmp
32 WizardSmallImageFile=..\misc\media\icon-install.bmp
33 AppVersion=0install
34 UninstallDisplayName={cm:UninstallProgram,%(AppName)s}
35 UninstallDisplayIcon={app}\%(AppName)s-uninstall.ico
36 AlwaysShowComponentsList=false
37 ShowLanguageDialog=auto
38 MinVersion=0,6.1.2600
39 DisableDirPage=yes
40 UsePreviousGroup=False
41 DisableProgramGroupPage=yes
42 SignTool=sign.cmd
43 SignedUninstaller=yes
44
45 [Languages]
46 Name: english; MessagesFile: ..\misc\InnoSetup\v5\Default.isl;
47 Name: french; MessagesFile: ..\misc\InnoSetup\v5\Languages\French.isl;
48 Name: german; MessagesFile: ..\misc\InnoSetup\v5\Languages\German.isl;
49 Name: italian; MessagesFile: ..\misc\InnoSetup\v5\Languages\Italian.isl;
50 Name: spanish; MessagesFile: ..\misc\InnoSetup\v5\Languages\Spanish.isl;
51
52 [Tasks]
53 Name: calibrationloadinghandledbydisplaycal; Description: {cm:CalibrationLoadingHandledByDisplayCAL}; Flags: exclusive; GroupDescription: {cm:CalibrationLoading};
54 Name: calibrationloadinghandledbyos; Description: {cm:CalibrationLoadingHandledByOS}; Flags: exclusive unchecked; GroupDescription: {cm:CalibrationLoading}; MinVersion: 0,6.1.7600;
55
56 [Files]
57 Source: ..\%(AppName)s\theme\icons\%(AppName)s-uninstall.ico; DestDir: {app};
58
59 [Icons]
60 Name: {group}\%(AppName)s; Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "run --no-wait %(HTTPURL)s0install/%(AppName)s.xml";
61 Name: {group}\{cm:SelectVersion}; Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "run --refresh --customize --no-wait %(HTTPURL)s0install/%(AppName)s.xml";
62 Name: {group}\{cm:ChangeIntegration}; Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "integrate %(HTTPURL)s0install/%(AppName)s.xml";
63 Name: {group}\{cm:UninstallProgram,%(AppName)s}; Filename: {uninstallexe}; IconFilename: {app}\%(AppName)s-uninstall.ico;
64 Name: {group}\LICENSE; Filename: %(URL)sLICENSE.txt;
65 Name: {group}\README; Filename: %(URL)s;
66 Name: {commonstartup}\%(AppName)s Profile Loader; Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "run --batch --no-wait --offline --command=run-apply-profiles %(HTTPURL)s0install/%(AppName)s.xml"; OnlyBelowVersion: 0,6.0; Tasks: calibrationloadinghandledbydisplaycal;
67
68 [Run]
69 Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "integrate --refresh %(HTTPURL)s0install/%(AppName)s.xml"; Description: {cm:LaunchProgram,%(AppName)s}; Flags: runasoriginaluser
70 Filename: %(URL)s; Description: {code:Get_RunEntryShellExec_Message|README}; Flags: nowait postinstall shellexec skipifsilent;
71 Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "run %(HTTPURL)s0install/%(AppName)s.xml"; Description: {cm:LaunchProgram,%(AppName)s}; Flags: nowait postinstall skipifsilent
72 Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "run --batch --command=set-calibration-loading %(HTTPURL)s0install/%(AppName)s.xml"; Description: {cm:LaunchProgram,%(AppName)s}; Flags: RunAsCurrentUser; Tasks: calibrationloadinghandledbydisplaycal;
73 Filename: taskkill.exe; parameters: /im %(AppName)s-apply-profiles.exe; Flags: RunHidden RunAsCurrentUser;
74 Filename: schtasks.exe; parameters: "/Delete /TN ""%(AppName)s Profile Loader Launcher"" /F"; Flags: RunHidden RunAsCurrentUser;
75 Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "run --batch --no-wait --command=run-apply-profiles %(HTTPURL)s0install/%(AppName)s.xml"; Flags: RunAsCurrentUser; Tasks: calibrationloadinghandledbydisplaycal;
76 ; Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "integrate --machine --add=auto-start --batch %(HTTPURL)s0install/%(AppName)s.xml"; Description: {cm:LaunchProgram,%(AppName)s}; Flags: RunAsCurrentUser; Tasks: calibrationloadinghandledbydisplaycal;
77 Filename: {reg:HKLM\Software\Zero Install,InstallLocation|{reg:HKCU\Software\Zero Install,InstallLocation}}\0install-win.exe; Parameters: "run --batch --command=set-calibration-loading -- %(HTTPURL)s0install/%(AppName)s.xml --os"; Description: {cm:LaunchProgram,%(AppName)s}; Flags: RunAsCurrentUser; Tasks: calibrationloadinghandledbyos;
78
79 [Dirs]
80 Name: {commonappdata}\%(AppName)s; Permissions: users-modify;
81
82 [InstallDelete]
83 Type: files; Name: "{commonstartup}\dispcalGUI Profile Loader.lnk"
84 Type: files; Name: "{group}\*dispcalGUI*"
85 Type: files; Name: "{app}\dispcalGUI*.exe"
86 Type: files; Name: "{app}\lib\dispcalGUI*"
87 Type: files; Name: "{app}\screenshots\dispcalGUI*.png"
88 Type: files; Name: "{app}\theme\dispcalGUI*.png"
89 Type: files; Name: "{app}\theme\icons\dispcalGUI*.ico"
90 Type: files; Name: "{app}\theme\icons\16x16\dispcalGUI*.png"
91 Type: files; Name: "{app}\theme\icons\32x32\dispcalGUI*.png"
92 Type: files; Name: "{app}\%(AppName)s*.exe"
93 Type: files; Name: "{app}\python*.dll"
94 Type: files; Name: "{app}\lib\*.dll"
95 Type: files; Name: "{app}\lib\*.pyd"
96 Type: dirifempty; Name: "{app}\lib"
97 Type: files; Name: "{userstartup}\%(AppName)s Profile Loader.lnk"
98 Type: files; Name: "{commonstartup}\%(AppName)s Profile Loader.lnk"
99
100 [UninstallRun]
101 Filename: schtasks.exe; parameters: "/Delete /TN ""%(AppName)s Profile Loader Launcher"" /F"; Flags: RunHidden RunAsCurrentUser;
102
103 [Code]
104 function Get_RunEntryShellExec_Message(Value: string): string;
105 begin
106 Result := FmtMessage(SetupMessage(msgRunEntryShellExec), [Value]);
107 end;
108
109 function Get_UninstallString(AppId: string): string;
110 var
111 UninstallString: string;
112 begin
113 if not RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + AppId + '_is1', 'UninstallString', UninstallString) and
114 not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' + AppId + '_is1', 'UninstallString', UninstallString) and
115 not RegQueryStringValue(HKCU, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + AppId + '_is1', 'UninstallString', UninstallString) then
116 RegQueryStringValue(HKCU, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' + AppId + '_is1', 'UninstallString', UninstallString);
117 Result := RemoveQuotes(UninstallString);
118 end;
119
120 function Get_ZeroInstall_InstallLocation: string;
121 begin
122 if not RegQueryStringValue(HKLM, 'SOFTWARE\Zero Install', 'InstallLocation', Result) then
123 RegQueryStringValue(HKCU, 'SOFTWARE\Zero Install', 'InstallLocation', Result);
124 end;
125
126 function Get_ZeroInstall_Exe: string;
127 begin
128 Result := Get_ZeroInstall_InstallLocation() + '\0install-win.exe';
129 end;
130
131 function ZeroInstall_IsInstalled: boolean;
132 var
133 ExePath: string;
134 begin
135 ExePath := Get_ZeroInstall_Exe();
136 Result := (ExePath <> '') and FileExists(ExePath);
137 end;
138
139 procedure InitializeWizard();
140 begin
141 if not ZeroInstall_IsInstalled() then begin
142 ITD_Init;
143 ITD_AddFile('http://0install.de/files/zero-install.exe', ExpandConstant('{tmp}\zero-install.exe'));
144 ITD_DownloadAfter(wpReady);
145 end;
146 end;
147
148 procedure CurStepChanged(CurStep: TSetupStep);
149 var
150 ErrorCode: integer;
151 ZeroInstall: string;
152 UninstallString: string;
153 begin
154 if CurStep=ssInstall then begin
155 if not ZeroInstall_IsInstalled() then begin
156 if not Exec(ExpandConstant('{tmp}\zero-install.exe'), 'maintenance deploy --background --batch --machine', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
157 SuppressibleMsgBox(SysErrorMessage(ErrorCode), mbCriticalError, MB_OK, MB_OK);
158 if not ZeroInstall_IsInstalled() then
159 Abort();
160 end;
161 UninstallString := Get_UninstallString(ExpandConstant('{#emit SetupSetting("AppId")}'));
162 if UninstallString <> '' then begin
163 if not Exec(UninstallString, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then begin
164 SuppressibleMsgBox(SysErrorMessage(ErrorCode), mbError, MB_OK, MB_OK);
165 end else begin
166 Sleep(2000);
167 end;
168 end;
169 end;
170 end;
171
172 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
173 var
174 ErrorCode: integer;
175 ZeroInstall: string;
176 UninstallString: string;
177 begin
178 if CurUninstallStep=usUninstall then begin
179 if ZeroInstall_IsInstalled() then begin
180 ZeroInstall := Get_ZeroInstall_Exe();
181 if not Exec(ZeroInstall, 'remove --batch %(HTTPURL)s0install/%(AppName)s.xml', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
182 SuppressibleMsgBox(SysErrorMessage(ErrorCode), mbError, MB_OK, MB_OK);
183 end;
184 end;
185 if CurUninstallStep=usDone then begin
186 if ZeroInstall_IsInstalled() then begin
187 UninstallString := Get_UninstallString('Zero Install');
188 if (UninstallString <> '') and (SuppressibleMsgBox(FmtMessage(CustomMessage('AskRemove'), ['Zero Install']), mbConfirmation, MB_YESNO, IDNO) = IDYES) then
189 Exec(UninstallString, '', '', SW_SHOW, ewNoWait, ErrorCode);
190 end;
191 end;
192 end;