Re-order stack.sh 1: sanity checks

Part 1 of a series

Re-order the setup and check bits in the top portion of stack.sh to
have a logical flow with similar things done together.

No behaviour changes are intended aside from the order of execution.
Any such changes are bugs.

* Do sanity checks that have no configuration needs earlier
* Do supported distro check earlier

Change-Id: I7d15bac199d6c4382d4a4d222784d34f2707da56
Merge "Re-order stack.sh 1: sanity checks"