Create self extracting archive with autorun on linux for windows platform

6.4k views Asked by At

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.

4

There are 4 answers

1
Pascal Thivent On

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

4
Josiah Haswell On

While it's a bit late:

We just released a Maven plugin that can do this (docs at https://zephyr.sunshower.io/site/). It's free, open-source, and permissively licensed.

We bundle a JRE with our application using this plugin, then launch an IzPack installer with that JRE. It also supports code-signing, which we expect to have documented within the week.

0
dirkjot On

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.

1
cokedude On

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")