Refactor .travis/install.sh.

Fixes #1439.

Probably a few more bits that can be refactored but it's a start.
It looks like this changes the way that we indent `case` statements, is there a reason for this?