flash.sh: Rewrite to be more robust and useful for testing

As per b/148225837, the enterprise flashing script needed to support the
following features:

  - Flashing specific fastboot devices by serial number
  - Optionally not rebooting the board at the end
  - Checking for the presence of a specific device with retries

Additionally, this change swaps to using getopt to make option parsing better
for both the user and more robust for the script.

Change-Id: Ic69259785e7a6c6540151f5964a5bb8128f925d5
1 file changed