exercism/cli-www — pull request #12 by mkhl (2014-01-13 21:06:02+00:00)
Title: Rewrite CLI installer

The rewritten installer handles command line options
* `-v` to specify the version
* `-o` to specify the operating system
* `-a` to specify the architecture
as well as an argument to specify the installation directory.

The same settings can alternatively be provided as environment variables:
* `VERSION` to specify the version
* `OS` to specify the operating system
* `ARCH` to specify the architecture
* `DIR` to specify the installation directory.

This means that the following are equivalent:
* `install -o linux /exercism/bin`
* `DIR=/exercism/bin OS=linux install`

Default values for all settings are determined in the established way, except
for the installation directory, which is guessed as:
* `/usr/local/bin` when
* the installer is run as root *or*
* the current user can write to that directory
* `$HOME/bin` otherwise
When run interactively, the user will be prompted for an installation directory,
with the default directory determined above as the default choice.

The installer checks
* prerequisites (`curl` or `wget` is available) before hitting the network
* that the installation directory
* exists or can be created
* is writable
* is part of `$PATH`

The rewritten installer is also POSIX shell compatible (tested with dash).