MSI - MS SQL
I am not familiar with bdist_msi
. However, it is definitely possible to post-process an MSI file to add registry entries if you have the right tools to do so. I am not sure if you want this scripted and automated, or if any manual steps with an appropriate tool is OK?
As you have understood from using the python library msilib
, an MSI file is really a primitive MS SQL database under the hood, and you can update it using automation and a primitive SQL dialect. See "Hotfixing MSI using WiRunSQL.vbs
" below. The msilib
is probably just a wrapper accessing the MSI COM API - or the down-to-the-metal Win32 C++ functions - you see how little I know about Python :-). Some context on COM vs Win32 (not important for you I think).
If you insert entries in the MSI database tables, you don't really need to know the component name generated by bdist_msi
, you can insert new records in both the Component table
and in the Registry table
with whatever records you need (in addition to those created by bdist_msi
). Then you need to also write to the FeatureComponents table
to add the component to a feature. Not quite trivial, but not that bad either I guess. I don't have any sample Python code using msilib
, but it sounds like you already have that? Maybe a sample using regular MSI API? Here goes:
Hotfixing MSI using WiRunSQL.vbs: There is a VBScript in the MSI SDK called WiRunSQL.vbs
that can be used to insert data directly into an MSI file in a scripted fashion in a very simple fashion (just simplified SQL). I describe this briefly in this answer (bottom). If you have Visual Studio installed, just search for the VBScript file under Program Files (x86)
.
Easy Fix?: Could the above SQL hotfixing VBScript be all you need? It is very simple to use and to automate, and it is a Microsoft VBScript. Few other entanglements and layers of indirection.
Quick MSI Update Mockup
Sample changes to MSI (open links to MSDN to see what each column means):
Component Table: (rolling with standard Pope-Mo-GUID
:-)
)
MyComp
, {77777777-7777-7777-7777-777777777777}
, TARGETDIR
, 4
, MyValue
Registry Table:
MyValue
, -1
, Software\[Manufacturer]\[ProductName]\New_Key
, Value
, 1
, MyComp
FeatureComponents Table:
MyFeature
, MyComp
Manual Tweaks Using Tools:
I hope the above made some sort of sense. Let me spin through a few "manual" or non-scripted / non-automated alternatives:
Free Tools: There are several tools you can try. That link describes the free Orca (offical Microsoft SDK MSI viewer and editor - if you got Visual Studio installed try searching for Orca-x86_en-us.msi
- under Program Files (x86)
- then just install it), SuperOrca and InstEd. Those are free tools.
Commercial Tools With Free Features: There is also Advanced Installer - a commercial tool that allows some basic functionality for free. I think that includes adding a registry key entry. I just tested that it works in the full version. This tool has much better GUI than Orca or the other free tools - and updates all associated tables automagically. I am not aware of any free features in Installshield or PACE Suite - the other major commercial tools, but should you already have them available, then they can do the job easily. And a quick mention: List of major, established deployment tools.
WiX: Seeing as you appear somewhat familiar with WiX, one option would be to (re)-build the whole installer with WiX. Maybe you already do? You can decompile an existing MSI to WiX format using dark.exe
. This dark.exe process is described here (section 4). You can then update the WiX XML and recompile - though this may require some black art and massage to work.
Some Links: