Removed some duplication and improved logic

As you can see, due to the amount of duplication between the macosx/linux blocks, I've factored out the differences to the `$OS` and `$OS_STRING` variables, so we only have the installer logic once.

I've changed the Cygwin test to be more robust, rather than depending on a (variable) hard-coded uname output, we're checking for the presence of the `$COMSPEC` variable. `%COMSPEC%` is a Windows environment variable specifying the full path to the command processor (aka the Windows  CMD shell). The value of this variable is typically `%SystemRoot%\system32\cmd.exe`, which typically evaluates to `C:\Windows\system32\cmd.exe`[[1]](http://stackoverflow.com/a/18790824/2386529)

A more important change here is that we require the script to be executed as `sudo`, rather than trying to get `sudo` from within the script. This just serves as a good way to explain to the user why it needs sudo, rather than them running the script and it then prompting them for their password.