Install the drivers with short file names (#76)
authorChristian Ullrich <chris@chrullrich.net>
Mon, 9 Dec 2024 13:54:54 +0000 (14:54 +0100)
committerGitHub <noreply@github.com>
Mon, 9 Dec 2024 13:54:54 +0000 (08:54 -0500)
* Install the drivers with short file names

This avoids the need to post-process the MSI file to work around
http://wixtoolset.org/issues/1422/ (installing ODBC drivers with long
file names fails).

For compatibility with existing configurations the short-named DLLs are
also installed with their original long names.

* Remove modify_msi.vbs

installer/buildInstallers.ps1
installer/modify_msi.vbs [deleted file]
installer/psqlodbcm_cpu.wxs

index 20e15ef078b2ddd900f9eb7877eaa7dcef483e10..7ba24ba80bc6b28626f81808dbe3764ba420e9d0 100644 (file)
@@ -281,12 +281,6 @@ function buildInstaller([string]$CPUTYPE)
            throw "Failed to build installer database"
        }
 
-       Write-Host ".`nModifying psqlODBC installer database..."
-       cscript modify_msi.vbs $INSTBASE\psqlodbc_$CPUTYPE.msi
-       if ($LASTEXITCODE -ne 0) {
-           throw "Failed to modify installer database"
-       }
-
        Write-Host ".`nDone!`n"
    }
    catch [Exception] {
diff --git a/installer/modify_msi.vbs b/installer/modify_msi.vbs
deleted file mode 100755 (executable)
index 8934411..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-'
-'  When the dll name of the driver is not of 8.3-format
-'      the modification of the FileName is needed
-'
-' This is to work-around an oversight in Windows Installer, see
-' http://wixtoolset.org/issues/1422/
-'
-' We remove the short name from the filename field in the File-table
-' of the two DLLs that need to be registered as ODBC drivers. Strictly
-' speaking, that makes the contents of the table invalid, because a short
-' name is mandatory, but Windows Installer seems nevertheless install it
-' just fine.
-
-Option Explicit
-
-Const msiOpenDatabaseModeTransact = 1
-Const msiViewModifyInsert = 1
-Const msiViewModifyUpdate = 2
-Const query = "SELECT * FROM File"
-
-Dim installer, database
-Dim view, record
-Dim pos, filename
-
-Set installer = Wscript.CreateObject("WindowsInstaller.Installer")
-Set database = installer.OpenDatabase(WScript.Arguments(0), _
-                                      msiOpenDatabaseModeTransact)
-Set view = database.OpenView(query)
-view.Execute
-
-Set record = view.Fetch
-Do While Not record Is Nothing
-
-   filename = record.StringData(3)
-   pos = InStr(filename, "|psqlodbc")
-
-   If (pos > 0) Then
-
-       ' Remove the ShortName part
-       filename = Mid(filename, pos + 1)
-       WScript.echo record.StringData(3) & " -> " & filename
-
-       record.StringData(3) = filename
-       view.Modify msiViewModifyUpdate, record
-
-   End If
-
-   Set record = view.Fetch
-
-Loop
-
-database.Commit
index f2cd82ea4ba8dae9dec628b04315af24a42dfc5d..6eff2d09ee8b8e459a70f285dd0182fe2a308859 100644 (file)
@@ -52,7 +52,8 @@
     <Directory Id="INSTALLFOLDER" />
 
     <!-- PostgreSQL -->
-    <File Name="psqlodbc30a.dll" Source="$(BINBASE)\$(ANSIFOLDER)\psqlodbc30a.dll">
+    <File Name="podbc30a.dll" Source="$(BINBASE)\$(ANSIFOLDER)\psqlodbc30a.dll">
+      <CopyFile DestinationName="psqlodbc30a.dll" />
       <ODBCDriver Id="Psqlodbc_9.0_Driver_ANSI" Name="PostgreSQL ANSI($(Platform))">
         <Property Id="CPTimeout" Value="60" />
       </ODBCDriver>
@@ -65,7 +66,8 @@
     <File Name="psqlodbc30a.pdb" Source="$(BINBASE)\$(ANSIFOLDER)\psqlodbc30a.pdb" />
     <File Name="pgenlista.pdb" Source="$(BINBASE)\$(ANSIFOLDER)\pgenlista.pdb" />
 <?endif ?>
-    <File Name="psqlodbc35w.dll" Source="$(BINBASE)\$(UNICODEFOLDER)\psqlodbc35w.dll">
+    <File Name="podbc35w.dll" Source="$(BINBASE)\$(UNICODEFOLDER)\psqlodbc35w.dll">
+      <CopyFile DestinationName="psqlodbc35w.dll" />
       <ODBCDriver Id="Psqlodbc_9.0_Driver" Name="PostgreSQL Unicode($(Platform))">
         <Property Id="CPTimeout" Value="60" />
       </ODBCDriver>