Just Install My Stuff

5 minute read

Unattended software installation on Windows (and software installation in general) is a mess. After evaluating several existing tools, including Chocolatey and Npackd, and having found fundamental flaws in them, I decided to roll my own.

Introduction

Lately, I’ve had to manage a couple of Windows virtual machines. Being the UNIX nerd I am, and having used Linux almost exclusively for the past thirteen years, there’s a growing feeling of confusion and discomfort whenever I approach a Windows machine.

I always found Microsoft product pages to be full of incomprehensible acronyms and market buzzwords and their configuration management tools are everything but lean and lightweight.

On top of that, the market seems to ignore Microsoft’s recommendations about software distribution methods. Despite the fact that MSI (Windows Installer) is the recommended way to distribute software packages on Windows, its adoption isn’t as widespread as one would hope and Microsoft is to blame for this situation since they were utterly unable to make MSI authoring tools available at no cost for developers.

The end result is an “everyone rolls its own” situation with MSI being a drop in the ocean of software installation engines, with other contenders being InnoSetup, NSIS, InstallShield and many obscure others.

Some enlightened members of the Windows community tried to put remedy to all this fragmented nonsense and several solutions have popped up since. I briefly evaluated Ninite, Npackd and Chocolatey. However, I found several fundamental issues with each and every one of them. That’s why I finally ended up writing my own solution.

What follows is a short review of several automation frameworks along with reasons for discarding them.

Ninite

This is definitely the best tool of the pack. However, it is a commercial solution and the list of program it supports is hard-coded and limited to popular consumer software. It is pretty much useless for a developer. Users can request new software to be added, but as with any proprietary solution, one can only hope the developer is kind enough to listen to your request.

Not being able to add support for the software I use is a deal breaker.

Npackd

Npackd manages to grab the second place in my list. It’s a beautifully simple C++/Qt application which will happily fetch and install any package it knows about. It’s open source and it’s reasonably easy to add new software to its repository. It comes with both command line and graphical user interfaces.

It’s quite easy to install too, since a simple msiexec.exe /qb /i http://bit.ly/npackdcl-1_17_9 is sufficient to obtain it.

It has one problem though: it tries to be smart by overriding installation paths and detecting whether the package had already been installed. To make matters worse it looks like the “install” command isn’t idempotent and often times it ends up re-installing the same package over and over, randomly moving files and directories in the process.

Chocolatey

There’s a lot of buzz surrounding Chocolatey these days. It looks like it may fix the situation once and for all. Just not in this decade. I found it to be a terribly frustrating piece of software.

Let’s begin with its installation process. Want to install Chocolatey on a new computer? Just run this simple command:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

Seriously?

How in heaven am I ever going to remember that?

Speaking of the installation procedure, there are also a couple of other things they don’t tell you: it depends on .NET 4.0 and you’ll get to know that only when you cinst a package for the first time. It’s even worse on Windows XP: in this case you have to install .NET 2.0 Sp1, then PowerShell 2.0, then .NET 4.0 and then Chocolatey. These dependencies are nowhere to be found on Chocolatey’s website even though:

  1. .NET 4 is not pre-installed on any version of Windows, except for Windows 8
  2. Windows XP is listed as a supported platform

Thanks so much for painless installation.

But this is just the tip of the iceberg. For starters: Chocolatey is slow, as in really, painfully, slow. Especially inside a virtual machine. It takes around 40 seconds just to figure out whether a package exists or not. If it does, it then bombards you with elevation prompts for each and every dependency it’s trying to install and when it bombs out for any reason it marks the package as successfully installed even if it knows it was unable to perform the installation.

I am surprised that its developers added support for Python eggs and Ruby gems when it’s unable to manage itself.

just-install my stuff

These packages try to solve a simple problem in a very complicated way. At the end of the day it all boils down to:

  1. Downloading the installer;
  2. Performing a silent installation;

See? No need to override installation paths, detect whether a package is already installed or do other complicated stuff. The package itself is responsible for all of this.

Don’t like where a package is being installed by default? Talk to upstream. The installer isn’t able to properly update an application? Talk to upstream. You get the idea.

I decided to sit down and decided to solve this problem once and for all. That’s how just- install was born. It’s the simplest and stupidest “package manager” you can think of. Around 150 lines of Python code, a third of which are comments, packaged as a stand-alone executable which you can easily install everywhere and it’s also very easy to use:

just-install firefox python pyqt

The “registry” defines from where an installer can be downloaded and how just-install can run it to perform a silent installation.

Conclusion

I came up with my solution to the problem, some would say I’m reinventing the wheel, even though I feel like I came up with a wheel which is rounder than the alternatives. just-install isn’t perfect (there’s no error handling, for example) but it fits my needs way better than Npackd or Chocolatey and I’m sure it will help you too. Plus, it’s open source, so why not give it a spin and contribute something back?