Hello,
I was wondering if NSIS is the best choice for Shoes installation on
Windows platforms. I am afraid it leads to some inconsistencies when
uninstalling particularly. Why not use MSI directly ?
WiX (http://wix.sourceforge.net) is an open-source framework to create
msi packages. It's based on xml source files, and it's very nice to
use. To let you have a look at this solution, here are some steps to
get you started :
1. Download and extract
http://wix.sourceforge.net/releases/3.0.4721.0/wix3-binaries.zip in a
specific directory (in my case, C:\wix)
2. Adapt the 2 first lines of the attached ruby script then launch it.
I know this script is plenty of crap.It's just a way to get you
started faster and show you what's important to change in the
autogenerated .wxs and what command-lines must be executed, not
something really usable.
The msi package itself is VERY primitive for now, i.e. there are no
menu shortcuts, file associations etc. But all that is very easy to
add.
Enjoy, and please... comment. If you like WiX, msi is a good standard
and makes app tracking/uninstallation/repair/patches easy. (Yes,
patches, you've read well. So fast updates, and so on...)
regards,
Lionel
CURRENT_SHOES_INSTALL_DIR = ENV["COMMONPROGRAMFILES"]
WIXDIR = 'C:\wix'
# Harvest the existing Shoes installation dir to get a first draft of the wxs file
puts "Harvesting current shoes installation..."
`#{WIXDIR}\\heat.exe dir -ag -sfrag -template:product "#{CURRENT_SHOES_INSTALL_DIR}" -out shoes_draft.wxs`
# process the draft to get something compilable
puts "Doing tricky manipulations... ;)"
require 'hpricot'
wxs = Hpricot.XML(File.read("shoes_draft.wxs"))
(wxs/:Product).set(
:Id => "45c22550-c295-11dd-ad8b-0800200c9a66",
:Manufacturer => "Hackety.org",
:Name => "Shoes",
:UpgradeCode => "08f7e263-e632-44be-a6f9-a61ea3d704f0"
)
(wxs/"[EMAIL PROTECTED]'Shoes']").set( :Id => "SHOESINSTALLDIR")
# What a pity that Hpricot downcases my elements...
# wrap() would have been useful but I cannot use hpricot more :(
doc = wxs.to_s
# Add the ProgramFiles folder
doc.gsub!('<Directory Name="SourceDir" Id="TARGETDIR">',
'<Directory Name="SourceDir" Id="TARGETDIR"><Directory Id="ProgramFilesFolder">')
doc.gsub!('<Feature', "</Directory>\n<Feature")
# Add the User Interface extension
doc.gsub!('</Product>',
'<UI>
<Property Id="WIXUI_INSTALLDIR" Value="SHOESINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
</UI>
</Product>')
# Rename the default feature
doc.gsub!("PUT-FEATURE-TITLE-HERE", "Default")
puts 'Saving the file "shoes.wxs".'
File.open('shoes.wxs','w') { |f| f.write(doc) }
puts "Calling candle.exe (compiler)..."
puts `#{WIXDIR}\\candle.exe shoes.wxs`
puts "Calling light.exe (linker)..."
puts `#{WIXDIR}\\light.exe shoes.wixobj -ext WixUIExtension`
puts "Here you should get shoes.msi! Have fun! Press Enter to exit."
gets