From 441aa49f78a7e2999b42a06415c9b74c624d0f36 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sat, 5 Oct 2024 13:18:01 +0200 Subject: [PATCH 01/11] Make product code automatically random Instead of externally generating it and using it explicitly. --- installer/buildInstallers.ps1 | 5 +---- installer/psqlodbc_cpu.wxs | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/installer/buildInstallers.ps1 b/installer/buildInstallers.ps1 index 6373db61..a1f15f09 100644 --- a/installer/buildInstallers.ps1 +++ b/installer/buildInstallers.ps1 @@ -263,9 +263,6 @@ function buildInstaller([string]$CPUTYPE) New-Item -ItemType directory -Path $CPUTYPE | Out-Null } - $PRODUCTCODE = [GUID]::NewGuid() - Write-Host "PRODUCTCODE: $PRODUCTCODE" - try { pushd "$scriptPath" @@ -285,7 +282,7 @@ function buildInstaller([string]$CPUTYPE) Write-Host ".`nBuilding psqlODBC installer database..." - candle -nologo "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dPRODUCTCODE=$PRODUCTCODE" "-dINSTBASE=$INSTBASE" -o $INSTBASE\psqlodbc.wixobj psqlodbc_cpu.wxs + candle -nologo "-dPlatform=$CPUTYPE" "-dVERSION=$VERSION" "-dSUBLOC=$SUBLOC" "-dINSTBASE=$INSTBASE" -o $INSTBASE\psqlodbc.wixobj psqlodbc_cpu.wxs if ($LASTEXITCODE -ne 0) { throw "Failed to build installer database" } diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index b49b92c1..ddbd8541 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -42,7 +42,7 @@ Date: Sun, 6 Oct 2024 17:30:35 +0200 Subject: [PATCH 02/11] Componentize the merge module This prevents upgrades from leaving files from the previous version behind that are not in the new version. --- installer/psqlodbc_cpu.wxs | 2 +- installer/psqlodbcm_cpu.wxs | 226 ++++++++++++++++++++++-------------- 2 files changed, 141 insertions(+), 87 deletions(-) diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index ddbd8541..800e0353 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -153,7 +153,7 @@ NEWERFOUND AND NOT Installed REINSTALLMODE AND NOT Installed UPGRADEFOUND AND REINSTALLMODE - UPGRADEFOUND AND NOT Installed + UPGRADEFOUND AND NOT Installed diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index 1edbf1e4..82ad3261 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -20,8 +20,6 @@ - - @@ -34,8 +32,6 @@ - - @@ -60,134 +56,192 @@ SummaryCodepage="1252" /> - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + - + + + + + + - + + - + + + - + + + - + + + - + + + - + + + - + + + - - - + + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + From fcb4bf898fa93833fb10c5ce67fe7bb7c638c18c Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sat, 5 Oct 2024 17:32:28 +0200 Subject: [PATCH 03/11] Configure drivers on x64 The Way It Should Be Done Use the ODBCDriver element only, without additional Registry settings. This works, although it does not solve the file name issue and therefore still requires removing the short file names from the File table. It also works for installing the x86 driver on an x64 system. Whether it works on an x86 system remains unknown. --- installer/psqlodbcm_cpu.wxs | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index 82ad3261..952fc2cc 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -72,7 +72,14 @@ - + + + + + + + + @@ -86,7 +93,14 @@ - + + + + + + + + @@ -193,17 +207,9 @@ works. Nowadays, it probably would be safe to use ODBCDriver on all platforms, but no-one's gotten around to revisit this --> - - - - - - - - - - - + + + @@ -225,8 +231,9 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - @@ -24,9 +11,9 @@ - + + - @@ -34,6 +21,12 @@ + + + + + + @@ -55,7 +48,6 @@ Comments="PostgreSQL ODBC Driver" Manufacturer="PostgreSQL Global Development Group" InstallerVersion="300" - Platform="$(var.Platform)" Languages="1033" Compressed="yes" SummaryCodepage="1252" /> @@ -67,13 +59,13 @@ - + - + @@ -91,7 +83,7 @@ - + diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index 08208493..3ef6a855 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -1,21 +1,13 @@ - - - - - - - - - - - + + + @@ -26,7 +18,8 @@ - + + @@ -38,6 +31,8 @@ + + @@ -71,7 +65,7 @@ --> - + @@ -81,18 +75,18 @@ - + - + - + - + @@ -102,101 +96,101 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -206,7 +200,7 @@ 32bit machines. We had better register the XA DLL on installation. --> - + From 1c2822799d48b1a357bca024d0bceaee7e964013 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sun, 6 Oct 2024 12:25:23 +0200 Subject: [PATCH 06/11] Reindent --- installer/psqlodbc_cpu.wxs | 54 ++++---- installer/psqlodbcm_cpu.wxs | 240 ++++++++++++++++++------------------ 2 files changed, 152 insertions(+), 142 deletions(-) diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index c8438b50..fb456efb 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -21,7 +21,7 @@ - + @@ -114,38 +114,48 @@ - - - - + + + + + Minimum="$(var.VERSION)" IncludeMinimum='yes' + Maximum="$(var.VERSION)" IncludeMaximum='yes' /> + Minimum="$(var.VERSION)" IncludeMinimum='no' /> + Minimum='8.3.0' IncludeMinimum='yes' + Maximum="$(var.VERSION)" IncludeMaximum='no' /> + Error="the same version of [ProductName] is already installed" /> + Error="a new version of [ProductName] is already installed" /> + Error="REINSTALL unavailable. Major upgrade is needed." /> - - - SELFFOUND AND NOT Installed - NEWERFOUND AND NOT Installed - REINSTALLMODE AND NOT Installed - UPGRADEFOUND AND REINSTALLMODE - UPGRADEFOUND AND NOT Installed - + Error="REINSTALL unavailable. Install the package first." /> + + + + SELFFOUND AND NOT Installed + + + NEWERFOUND AND NOT Installed + + + REINSTALLMODE AND NOT Installed + + + UPGRADEFOUND AND REINSTALLMODE + + + UPGRADEFOUND AND NOT Installed + + diff --git a/installer/psqlodbcm_cpu.wxs b/installer/psqlodbcm_cpu.wxs index 3ef6a855..8fa3350f 100644 --- a/installer/psqlodbcm_cpu.wxs +++ b/installer/psqlodbcm_cpu.wxs @@ -31,7 +31,7 @@ - + @@ -51,165 +51,165 @@ - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - + + + + + + + + + + + From ee9c759df3b00141e767480150ddea28c26a6be7 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sun, 6 Oct 2024 12:24:29 +0200 Subject: [PATCH 07/11] Save some attributes --- installer/psqlodbc_cpu.wxs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index fb456efb..2b2aa213 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -64,16 +64,16 @@ - + - - - - - - - - + + + + + + + + From 2bc0347f72ccaf0f40787d63f00fede50c420a41 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sun, 6 Oct 2024 12:34:38 +0200 Subject: [PATCH 08/11] Replace upgrade logic with MajorUpgrade element This element compiles into approximately the same entries in the Upgrade, CustomAction, and InstallExecuteSequence tables. --- installer/psqlodbc_cpu.wxs | 40 +++----------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index 2b2aa213..28191add 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -120,42 +120,8 @@ - - - - - - - - - - - - - - SELFFOUND AND NOT Installed - - - NEWERFOUND AND NOT Installed - - - REINSTALLMODE AND NOT Installed - - - UPGRADEFOUND AND REINSTALLMODE - - - UPGRADEFOUND AND NOT Installed - - + From 84c19406e1f610b5b54ecceb87d2eb0d2d0b2cc0 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sun, 6 Oct 2024 12:36:55 +0200 Subject: [PATCH 09/11] Remove unused GUID I think this was the product code, a long time ago. --- installer/psqlodbc_cpu.wxs | 2 -- 1 file changed, 2 deletions(-) diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index 28191add..cb6402b8 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -5,7 +5,6 @@ - @@ -15,7 +14,6 @@ - From f3541e214852beab24a44e2023fe75894d842d38 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sun, 6 Oct 2024 13:53:36 +0200 Subject: [PATCH 10/11] Make MSI file smaller By about 20 percent. --- installer/psqlodbc_cpu.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/psqlodbc_cpu.wxs b/installer/psqlodbc_cpu.wxs index cb6402b8..2038ddd6 100644 --- a/installer/psqlodbc_cpu.wxs +++ b/installer/psqlodbc_cpu.wxs @@ -103,7 +103,7 @@ - + From 77b120508555fc084999a056ae4f04ab4f426213 Mon Sep 17 00:00:00 2001 From: Christian Ullrich Date: Sat, 12 Oct 2024 11:42:51 +0200 Subject: [PATCH 11/11] Better select where to remove short file names Use the FileName column itself instead of the file ID. This is less susceptible to changes in file IDs (and component IDs) that may happen when relying more on default behaviors in future WiX versions. --- installer/modify_msi.vbs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/installer/modify_msi.vbs b/installer/modify_msi.vbs index c1353fc8..9f586602 100755 --- a/installer/modify_msi.vbs +++ b/installer/modify_msi.vbs @@ -34,19 +34,16 @@ Dim record Set record = view.Fetch Dim gFile, pos Do While not record Is Nothing -gFile = record.StringData(1) -If Left(gFile, 8) = "psqlodbc" Then - gFile = record.StringData(3) - ' Check if the FileName field is ShortName|LongName - pos = InStr(record.StringData(3), "|") - If pos > 0 Then - ' Omit the ShortName part - gFile = Mid(record.StringData(3), pos + 1) - WScript.echo record.StringData(3) & " -> " & gFile - ' And update the field - record.StringData(3) = gFile - view.Modify msiViewModifyUpdate, record - End If +' Check if the FileName field is ShortName|LongName +gFile = record.StringData(3) +pos = InStr(gFile, "|psqlodbc") +If (pos > 0) Then + ' Omit the ShortName part + gFile = Mid(gFile, pos + 1) + WScript.echo record.StringData(3) & " -> " & gFile + ' And update the field + record.StringData(3) = gFile + view.Modify msiViewModifyUpdate, record End If Set record = view.Fetch Loop