Compiling a bash script into a Windows executable

I have a script that was originally created for Linux, but has been adapted to work with Cygwin on Windows, and if you already have executable files (sh, cp, mv, etc.), you can run it without Cygwin. The only problem is that the script also uses several hundred (yes hundreds) of other executables. Is there any way to compile this script into a regular executable file and pack these other supporting files as resources?

The script is ~ 1600 lines long, which is probably too long to be manually manually reinstalled in C ++. I am going to compile the script into something that the window can execute without having to make any changes to the path to include a bunch of third-party executables. A way to contain it all.

+4
source share
4 answers

I doubt the solution you have in mind is possible.

Instead, I would modify the script, so the first thing it does is find out where all these hundreds of executables are located. Then either set $PATH accordingly, or call each one in its full path.

Or you may have an installer that installs executables in a location specified or selected by the user, and then re-creates the script (from the input file) so that it knows where the executables are located. Ship with the-script.in , then ask the installer to perform textual substitutions to generate the-script from the-script.in .

+2
source

I indicate:

RPM and SHC

as a possible solution to your problem. Perhaps these tools will help you cope with this task.

+1
source

Using SHC for Cygwin allows you to compile bash into exe OK. Really old, but I was looking for it and decided to do my thing and make it publicly available. http://goo.gl/M1NSY

0
source

Use the ports required by utils and use the application virtualization tool to pack it all. Cameyo is free. Forget Cygwin, this huuuge thing :)

0
source

All Articles