I found this works well using the 7zip command line approach (which is detailed in other topics on the forum).
The problem with this solution however is that the "required space" display does not take into account the size of the data in the external archive.
As a solution, I've written a little python script to calculate the size of the archive, and replace a predefined string ("%data_size%") in the nsis script with this value:
Here's the relevant part of the nsis script:
os.system( "7z l -slt archive.7z > size_data.txt" )
file_ = open( "size_data.txt", "rt" )
data = file_.read()
file_.close()
os.remove( "size_data.txt" )
l = data.split("\nSize = ")
total = 0
for i in range( len(l) ):
if i > 0: # The first item is useless
total += int(l[i].split("\nPacked Size")[0])
total /= 1024 # Convert to Kilobytes
print total
versionedInstFile = open( "Versioned Installer.nsi", "rt" )
versionedInstStr = versionedInstFile.read()
versionedInstFile.close()
versionedInstStr = versionedInstStr.replace( "%data_size%", str(total) )
f = open( "Versioned Installer.nsi", "wt" )
f.write( versionedInstStr )
f.close()
Section "yay" SecYay
...
AddSize %data_size%
SectionEnd