Create self extracting archive with autorun on linux for windows platform

Tag: maven-2 , installer , self-extracting Author: tophd Date: 2009-11-28

Our application is distributed as a zip file, with a small bat/shell script that the user runs after extracting the archive to install the application. This zip file is currently created via mavens assembly plugin.

The zip file we distribute contains a lib folder with an executable jar, as well as all the files we need as part off the deployment off the actual application.

What we want is a self extracting zip-file that executes that contained bat file after the zip file has been extracted. And this should be created as a part off the build process.

I have read creating-a-self-extracting-zip-archive-on-a-linux-box, and can do that. But I don't see anywhere how to also execute a bat file within the extracted archive when it's done.

I have found winzip self-extractor, but I would prefer something that can be run on any platform. The build server and some developers use linux. I also found some VB code which leads me to believe that there might be some autorun properties on zip files.

Other Answer1

Did you consider using IzPack (and the IzPack Maven Plugin) to generate a cross-platform installer?

comments:

Yes, however there is a current installer app, and that would mean rewritting the installer to be an IzPack installer. I would want to do that in the future, but right now the app is both an installer and an application manager. So it serves as more than an installer.

Other Answer2

The previous replier suggested lzpack, it's documentation contains the following pointer:

""The 7-Zip project (see http://www.7-zip.org/) provides a so-called SFX for installers, i.e., an image that can be use to create self-extracting Windows executables. Once its content has been extracted, such a self-extracting executable can launch an executable or a file. In the later case, it is assumed that there exists an association between a file extension and a software component.""

7-zip is cross platform, although I haven't tried whether you can build sfx files for windows on linux.

Other Answer3

The 7zip manpage says you can do this.

EXAMPLE 2
       7z a -sfx archive.exe dir1
              add all files from directory "dir1" to  SFX  archive
              archive.exe  (Remark  :  SFX  archive  MUST end with
              ".exe")