Archive: Avoid recompressing .cab's?


Avoid recompressing .cab's?
I'm using NSIS as a wrapper for WinINSTALL .msi files (and their corresponding data directories) to facilitate unattended software installations on Windows 2000 machines.

Unfortunately, whenever I compile a NSIS script for a program which contains many compressed .cab files, the compiler tries valiantly to recompress them. Naturally, it fails to save much disk space but adds a LOT of time to the compile process.

Does anyone know of a way to skip compression on files of certain types?

BTW, as this is my first post, I just want to add: "HOORAY FOR NSIS!" This is an awesome tool and a fantastic addition to the world of open source software. Combined with the free version of WinINSTALL and my monolithic VBScript to run the show, NSIS makes my unattended installs essentially automatic and virtually painless.


Use 'SetCompress off'.

Why not use NSIS for the installer logic too? There is no need to use VBScript etc., the NSIS script langauge allows you to add any custom logic you want.


I can't just turn compression off because I still want to compress all of the OTHER files. I just don't want to recompress those files that are already compressed cabinets. It would not be a simple task to turn compression on and off for each of the files because some programs (take any Microsoft application for example) contain scores of subdirectories full of all sorts of different file types. And that even pertains to the installation sources!

It sounds like I could do it if I had a code block for each subdirectory of my installation media tree (all eleventy-zillion of them) that would do the following:
- Move all ZIP, CAB, RAR, etc. files to a temp folder
- Add *.* (the non-archive files) to the NSIS package
- Move all ZIP, CAB, RAR, etc. files back to their original folder
- Turn off compression
- Add all ZIP files to the package
- Add all CAB files to the package
- Add all RAR files to the package
- etc...
- Turn compression back on again
Then repeat for each subdir!

*PUKE!!!*

FYI: I use a VB script because I am constantly adding packages to be installed (usually windows updates) and I don't want to have to recompile each time. This way, I can just append a couple of lines to the script that check the registry to see if the new program is installed, and then runs the new executable if it is not.

Since reboots are necessary, my VB script writes to the run key in the registry so that it launches again upon rebooting. The tail end of the script removes itself from the registry and either shuts down or reboots to allow me to inspect the machine (I've got another script to do that too... maybe I'll call it from my script and shut down or pop up a message if the inspection passes).

I'm installing dozens of commercial applications, many with settings that must be specified during install. WinINSTALL makes before and after disk images and takes the difference. The output is a set of folders (containing the files and folders that changed) and an .msi file. By applying the difference to a new machine, I perform an unattended install with the custom configuration information to boot.

WinINSTALL (the free version) does not, however, support compression. The output is just the difference-tree and the .msi file. Sending zillions of tiny, uncompressed files back and forth across the network is NOT the most efficient way of working. Hence my use of NSIS as a wrapper (and a free one).

With luck, I may even be able to get all of my NSIS installers onto the Win2K CD! Then all I'd have to do is wait untill Win2K finished installing (along with my NSIS installers) and install Office2K3 across the network (or *gasp* manually swap CD's).


'SetCompress off' does not have to apply to all files. Just set it before the CAB files and use 'SetCompress auto' afterwards.

This will only work if you are not using solid compression. ZLIB does not use solid compression by default. If you are using BZIP2 or LZMA see http://nsis.sourceforge.net/site/Spe...ilds.30.0.html


While I'm grateful for your help, I'm not really sure that solves my problem.

I was hoping to create a script that would work on any arbitrary group of directories. The method you suggest seems to require that I know which folders will contain compressed files. I'd much rather have the ability to add an entire tree with the File /r "C:\mypath\myfolder\*.*" command. This way, all I have to do is change the name of the root folder and it will work for any OTHER program.

I don't think this:

SetCompress off
File /r "C:\mypath\myfolder\*.cab"
File /r "C:\mypath\myfolder\*.zip"
File /r "C:\mypath\myfolder\*.arj"
SetCompress auto
File /r "C:\mypath\myfolder\*.*"

would work... would it?

(... well, there's one way to find out)


No, of course that won't work. It adds the .cab files twice!


I guess I could just delete all of the .cab's in the install tree... but this prevents me from compiling a script where the installation files are located on a read only medium like a CD-ROM.


Why not put the cab files in a different folder?