1
; Script for Inno Setup installer
2
; [[[cog cog.outl('; This script created by Cog from brz.iss.cog source') ]]]
4
; Cog is http://www.nedbatchelder.com/code/cog/
10
; # Python 2.5 compatibility code
14
; if cwd not in sys.path:
15
; sys.path.insert(0, cwd)
16
; #/Python 2.5 compatibility code
20
; VERSION = breezy.__version__
21
; AppVerName = 'Breezy %s' % VERSION
22
; OutputBaseFilename = 'brz-%s-setup' % VERSION
25
; AppVerName = 'Breezy'
26
; OutputBaseFilename = 'brz-setup'
28
; cog.outl('AppVerName=%s' % AppVerName)
29
; cog.outl('OutputBaseFilename=%s' % OutputBaseFilename)
32
OutputBaseFilename=brz-setup
35
DefaultDirName={pf}\Breezy
36
DefaultGroupName=Breezy
41
SourceDir="..\..\win32_brz.exe"
43
; TODO(jelmer): Add brz.ico
44
; SetupIconFile="..\brz.ico"
45
InfoBeforeFile="..\tools\win32\info.txt"
47
; VersionInfoCompany="Canonical Ltd."
48
VersionInfoCopyright="Canonical Ltd. et al"
49
VersionInfoDescription="Windows installer for Breezy"
53
; for i in breezy.version_info[:3]:
58
; version_number.append(i)
59
; # incremental build number
60
; from tools.win32.file_version import *
62
; version_prev = get_file_version(OutputBaseFilename + '.exe')
63
; except (FileNotFound, VersionNotAvailable):
66
; if version_number == list(version_prev[:3]):
67
; version_number.append((version_prev[-1]+1) % 65536)
68
; version_str = '.'.join(str(i) for i in version_number)
69
; cog.outl('VersionInfoVersion="%s"' % version_str)
73
AppComments="Breezy: Friendly distributed version control system"
74
AppPublisher="Breezy Developers"
75
AppPublisherURL="https://www.breezy-vcs.org/"
76
AppSupportURL="http://wiki.bazaar.canonical.com/BzrSupport"
77
AppUpdatesURL="http://wiki.bazaar.canonical.com/WindowsDownloads"
78
; [[[cog cog.outl('AppVersion=%s' % VERSION) ]]]
81
ChangesEnvironment=yes
82
; MARKH: PrivilegesRequired=none means it can't be installed by a non-admin
83
; user - but sadly we still need admin - eg, tortoise overlays, installing
84
; into "\Program Files", installing COM objects etc all must be done by an
86
PrivilegesRequired=admin
89
; Tortoise files - these are at the top as we use 'ExtractTemporaryFile' on
90
; the TortoiseOverlays MSI, and inno documents such files should be at the
91
; start for best performance.
93
; if "TBZR" in os.environ: # we need a more formal way of controlling this...
94
; tovmsi32 = os.environ["TORTOISE_OVERLAYS_MSI_WIN32"] # point at the 32bit TortoiseOverlays .msi
95
; tovmsi64 = os.environ["TORTOISE_OVERLAYS_MSI_X64"] # point at the 64bit TortoiseOverlays .msi
96
; cog.outl('Source: "%s"; Flags: dontcopy ignoreversion ; Components: tortoise' % tovmsi32)
97
; cog.outl('Source: "%s"; Flags: dontcopy ignoreversion ; Components: tortoise' % tovmsi64)
98
; cog.outl('Source: "tbzrcache.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
99
; cog.outl('Source: "tbzrcachew.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
100
; cog.outl('Source: "tbzrcommand.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
101
; cog.outl('Source: "tbzrcommandw.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
102
; cog.outl('Source: "tbzrtrace.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: debug')
103
; # Note 'regserver' here appears to run regsvr32 without elevation, which
104
; # is no good for us - so we have a [run] entry below.
105
; cog.outl('Source: "tbzr_old.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
106
; cog.outl('Source: "tbzrshellext_x86.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
107
; cog.outl('Source: "tbzrshellext_x64.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise; Check: IsWin64;')
108
; cog.outl(r'Source: "plugins\qbzr\*"; DestDir: "{app}\plugins\qbzr"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete; Components: tortoise')
110
; cog.outl('Source: "%s\\doc\\*.html"; DestDir: "{app}\\doc\\tbzr"; Flags: ignoreversion; Components: tortoise' % os.environ['TBZR'])
114
; We can't say '*.*' due to optional components.
115
Source: "plugins\*.*"; DestDir: "{app}\\plugins"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete; Components: plugins
116
Source: "*.bat"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
117
Source: "*.url"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
118
Source: "msvc*.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
119
Source: "bz*.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
120
Source: "Python*.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
121
Source: "lib\*.*"; DestDir: "{app}\lib"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;
122
Source: "doc\*.*"; DestDir: "{app}\doc"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;
126
; except ImportError:
129
; supported = pycurl.version_info()[8]
130
; if 'https' in supported:
131
; from breezy.transport.http.ca_bundle import get_ca_path
132
; ca_path = get_ca_path()
134
; cog.outl('Source: "%s"; DestDir: "{app}"; Components: cabundle' % ca_path)
136
; cog.msg('You have pycurl with SSL support, '
137
; 'but CA Bundle (curl-ca-bundle.crt) not found!')
141
; imageformats plugins for PyQt4
143
; plug_dir = os.path.join(os.path.dirname(cog.inFile), # $(bzr_src_root)/tools/win32
144
; '..', '..', 'win32_bzr.exe', 'imageformats')
145
; if os.path.isdir(plug_dir):
146
; cog.outl('Source: "imageformats\\*.*"; DestDir: "{app}\\imageformats"; '
147
; 'Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;')
149
; cog.msg('imageformats plugins for PyQt4 not found')
154
Name: "typical"; Description: "A typical installation"
155
Name: "full"; Description: "Full Installation (typical installation plus test utilities)"
156
Name: "compact"; Description: "Compact installation"
157
Name: "custom"; Description: "Custom installation"; Flags: iscustom
160
Name: "main"; Description: "Main Files"; Types: full typical compact custom; Flags: fixed
161
Name: "plugins"; Description: "Default plugins"; Types: full typical custom;
164
; cog.outl('Name: "cabundle"; '
165
; 'Description: "CA certificates for SSL support"; '
166
; 'Types: full typical custom')
167
; if "TBZR" in os.environ: # we need a more formal way of controlling this...
168
; cog.outl('Name: "tortoise"; Description: "Windows Shell Extensions (TortoiseBZR)"; Types: full typical custom;')
169
; cog.outl('Name: "debug"; Description: "Test, diagnostic and debugging utilities"; Types: full custom;')
175
Name: "{userappdata}\bazaar\2.0"
176
Name: "{app}\plugins"; Flags: uninsalwaysuninstall
180
Name: "{group}\Documentation index"; Filename: "{app}\doc\index.html"; WorkingDir: "{app}\doc";
181
Name: "{group}\Breezy Home Page"; Filename: "{app}\breezy.url"; Comment: "https://www.breezy-vcs.org/";
182
Name: "{group}\Start Bzr in cmd shell"; Filename: "{cmd}"; Parameters: "/K start_bzr.bat"; WorkingDir: "{app}"; IconFilename: "{app}\bzr.exe"; Comment: "Open new Bzr session";
183
; NOTE: Intent is to change the log file location - the line below will need to change to reflect that.
184
Name: "{group}\Open Bzr log file"; Filename: "notepad.exe"; Parameters: "{userdocs}\.bzr.log"; Comment: "Launch notepad to view the bzr log file";
187
; if "TBZR" in os.environ:
188
; cog.outl(r'Name: "{group}\TortoiseBZR documentation"; Filename: "{app}\doc\tbzr\index.html"; Comment: "Launch TortoiseBZR documentation";')
191
; No Uninstall here - Control Panel will do
195
Name: Path; Description: "Add {app} directory to PATH environment variable"
197
; if "TBZR" in os.environ:
198
; cog.outl('Name: TBZRReadme; Description: "View the TortoiseBZR Readme"; Components: tortoise')
204
Root: HKLM; Subkey: "SOFTWARE\Breezy"; Flags: noerror uninsdeletekey
205
Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "InstallPath"; ValueType: string; ValueData: "{app}"; Flags: noerror
206
; Don't write stuff that can be implied
207
;Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "breezyPath"; ValueType: string; ValueData: "{app}\lib\library.zip\breezy"; Flags: noerror
208
;Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "PluginsPath"; ValueType: string; ValueData: "{app}\plugins"; Flags: noerror
209
;Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "PythonPath"; ValueType: string; ValueData: "{app}\lib\library.zip"; Flags: noerror
210
; [[[cog cog.outl('Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "Version"; ValueType: string; ValueData: "%s"; Flags: noerror' % VERSION) ]]]
215
Filename: "{app}\brz_postinstall.exe"; Parameters: "--start-brz"; Flags: skipifdoesntexist runhidden;
216
Filename: "{app}\brz_postinstall.exe"; Parameters: "--add-path"; Tasks: Path; Flags: skipifdoesntexist skipifsilent runhidden;
218
; if "TBZR" in os.environ:
219
; cog.outl('Filename: "regsvr32.exe"; Parameters: "/s /i: /n tbzrshellext_x86.dll"; WorkingDir: "{app}"; Components: tortoise; Description: "Registering Tortoise"; StatusMsg: "Registering Tortoise"')
220
; cog.outl('Filename: "regsvr32.exe"; Parameters: "/s /i: /n tbzrshellext_x64.dll"; WorkingDir: "{app}"; Components: tortoise; Description: "Registering Tortoise"; StatusMsg: "Registering Tortoise"; Check: IsWin64')
221
; cog.outl(r'Filename: "{app}\doc\tbzr\index.html"; Tasks: TBZRReadme; Flags: shellexec')
227
Filename: "{app}\bzr_postinstall.exe"; Parameters: "--delete-path --delete-shell-menu --silent"; Flags: skipifdoesntexist runhidden;
229
; if "TBZR" in os.environ:
230
; cog.outl('Filename: "regsvr32.exe"; Parameters: "/u /s /i: tbzrshellext_x86.dll"; WorkingDir: "{app}"; Components: tortoise; StatusMsg: "Unregistering Tortoise"; Flags: skipifdoesntexist')
231
; cog.outl('Filename: "regsvr32.exe"; Parameters: "/u /s /i: tbzrshellext_x64.dll"; WorkingDir: "{app}"; Components: tortoise; StatusMsg: "Unregistering Tortoise"; Flags: skipifdoesntexist; Check: IsWin64')
238
SHCNF_IDLIST = $0000;
239
SHCNE_ASSOCCHANGED = $08000000;
241
MOVEFILE_DELAY_UNTIL_REBOOT = 4;
243
procedure SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2: Integer);
244
external 'SHChangeNotify@shell32.dll stdcall';
246
function MoveFileEx(lpExistingFileName, lpNewFileName: String; dwFlags: Cardinal): Integer;
247
external 'MoveFileExA@kernel32.dll stdcall';
249
procedure DeleteFileNowOrLater(filename: string);
253
if FileExists(filename) and not DeleteFile(filename) then
254
// can't work out to pass NULL to the API, but an empty string
256
MoveFileEx(filename, '', MOVEFILE_DELAY_UNTIL_REBOOT);
259
procedure ShutdownTBZR;
264
// if "TBZR" not in os.environ:
265
// cog.outl(' Exit; // No TSVN set - exit this procedure.')
268
// ask the cache process to shut-down.
269
hwnd := FindWindowByClassName('TBZRCache_Taskbar');
271
PostMessage(hwnd, WM_QUIT, 1, 0);
274
procedure CurStepChanged(CurStep: TSetupStep);
276
S, tovmsi, fqtovmsi, params: String;
279
if CurStep=ssInstall then begin
281
// In case the user hasn't uninstalled the old version before
282
// upgrading, we unregister and delete some obsolete files
283
// (regsvr32 remains silent even if the file doesn't exist)
284
Exec('regsvr32.exe', '/s /u "' + ExpandConstant('{app}\tbzr.dll') + '"',
285
'', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
286
DeleteFileNowOrLater(ExpandConstant('{app}\tbzr.dll'));
287
DeleteFileNowOrLater(ExpandConstant('{app}\tbzrtest.exe'));
288
DeleteFileNowOrLater(ExpandConstant('{app}\tbzr_tracer.exe'));
291
if CurStep=ssPostInstall then begin
292
// a couple of post-install tasks
293
if IsComponentSelected('tortoise') then begin
295
// msiexec /i TortoiseOverlays-1.X.X.XXXX-win32.msi /qn /norestart
297
// We are still primarily a 32bit application - the only 64bit binary is the
298
// shell extension, but even then, we need to install the 32bit version too.
299
// Thus, we keep tortoise in 32bit "install mode" - meaning we are installed
300
// to "\Program Files (x86)". We don't bother trying to install our single
301
// 64bit DLL into "\Program Files" - we use a different DLL name for 32 and
302
// 64 bit versions, so nothing will conflict.
303
// Note however that on a 64bit OS, we only need the 64bit TortoiseOverlays -
304
// the 32bit apps using shell extensions still work fine with that.
306
// if "TBZR" in os.environ:
308
// cog.outl("if IsWin64 then")
309
// cog.outl(" tovmsi := '%s'" % os.path.basename(os.environ["TORTOISE_OVERLAYS_MSI_X64"]))
311
// cog.outl(" tovmsi := '%s'" % os.path.basename(os.environ["TORTOISE_OVERLAYS_MSI_WIN32"]))
313
// cog.outl("tovmsi := '';")
316
ExtractTemporaryFile(tovmsi);
317
fqtovmsi := AddBackslash(ExpandConstant('{tmp}')) + tovmsi;
318
params := '/i "' + fqtovmsi + '" /qn /norestart';
319
if not ShellExec('', 'msiexec.exe', params, '', SW_HIDE,
320
ewWaitUntilTerminated, ErrorCode) then
321
MsgBox('Failed to install TortoiseOverlays: ' + SysErrorMessage(ErrorCode),
322
mbInformation, MB_OK);
323
// Ideally we could be bzr_postinstall.exe this way too, but
324
// its needed at uninstall time.
326
// cause explorer to re-fetch handlers.
327
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
332
function InitializeUninstall(): Boolean;