Travis: reorder tasks; rework shell conditionals for env variables