Automation evolves faster in POSIX environment

We all need to deal with Windows occasionally when systems include client-side non-web-based software. And one of the least mentally intrusive workflow with Windows machines is automation - isolate yourself from direct interaction with OS through code modification (IaC). The code modifies Windows on your behalf (rather than browsing menus and clicking on options).

To increase the level of comfort, it’s advisable to use POSIX-like environment with common scripting languages. And that’s where Cygwin kicks in.

Addressing repeated Cygwin installations

  • Now, how do we install Cygwin without involving menu browsing and option clicking?

  • How do we make it on tens, or hundreds, or thousands of Windows machines quickly and consistently?

  • How to avoid lengthy download times during installation?

  • Is it possible to remove the dependency on Internet entirely?

Luckily, it’s already done. Official Cygwin setup.exe already supports pre-downloading of selected packages and installing them offline (from pre-downloaded content).

Offline content delivery

Unfortunately, Cygwin setup.exe still requires a living Windows machine to run and produce the pre-downloaded content.

What if we could do it all on Linux?

Until deployment to target Windows is about to start, using Windows may be completely avoided.

I’ve been through attempts to automate the creation of the pre-downloaded Cygwin archives in the past. It was a painful scripting in Windows batch files (*.cmd) - a walk through the mine field of bug introduction.

It turned out that Wine on Linux can execute Cygwin setup.exe without noticeable issues. So, when I learned that Windows is not needed (until the very moment of deployment, as a target), this small project appeared - cygwin-offline.

It is a collection of scripts for Linux with Wine to prepare Cygwin package with user-selected pre-downloaded content.

In fact, you can even install Cygwin on Linux with Wine, but this is beyond the purpose of this post. And who would need Cygwin on Linux anyway?


The idea is simple:

  • To script downloading and archival of Cygwin distribution and do it on Linux.

  • The (future) deployment on Windows is done in a single click (running single batch file) and completely offline.

That way (by splitting the process per OS) you gain benefits in addition to those provided by offline package itself:

  • The continuous integration platforms do not need Windows nodes for the build phase (only for deployment).

  • The pain of batch files scripting is reduced to installation part only (which is relatively simple).

See the project readme for details.