We're having a lot of `if` and `then` here, is it preferable to move them into separate scripts(one for Mac, one for Linux) located in some directory like `ci` or `.travis` and call them instead? It could also be done in a separate PR and this PR just finishes the initial setup.