Remove guesswork for finding destination device

Either provided by --dst or already in the image in write_gpt.sh
script.

BUG=chromium:343182,chromium:340761,chromium:336654
CQ-DEPEND=CL:187423
TEST=Install on link, falco and peach
TEST= - recovery
TEST= - factory wipe/shell
TEST= - chromeinstall from USB key
TEST= - cros flash <machine>

Change-Id: I4ef59eb44ee6d94e08564a6821eb0596f4851b93
Reviewed-on: https://chromium-review.googlesource.com/187437
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
diff --git a/chromeos-install b/chromeos-install
index b3b68fa..04fad11 100755
--- a/chromeos-install
+++ b/chromeos-install
@@ -664,27 +664,13 @@
 # and partition information.
 STATEFUL_FORMAT=$(get_format ${STATEFUL_PART})
 
-# Find our destination device.  If the user hasn't selected one, and the
-# disk layout doesn't declare it for us, do some historical autoprobing.
-: ${FLAGS_dst:=${DEFAULT_ROOTDEV}}
-if [ -z "${FLAGS_dst}" ]; then
-  if [ "${ARCH}" = "INTEL" ]; then
-    # This finds the first ATA device listed by parted.
-    SD_INFO=$(parted -l -s -m 2> /dev/null)
-    DST=$(expr "${SD_INFO}" : ".*\(/dev/sd[^:]*\)[^;]*:ATA\ " || :)
-    if [ -z "$DST" ]; then
-      # See if we found a MMC device instead.
-      DST=$(expr "${SD_INFO}" : ".*\(/dev/mmcblk[^:]*\)[^;]*:MMC\ " || :)
-      if [ -z "${DST}" ]; then
-        # As a backup, install to /dev/sda
-        DST=/dev/sda
-      fi
-    fi
-  else
-    DST=/dev/mmcblk0
-  fi
-else
-  DST="${FLAGS_dst}"
+# Find our destination device.
+# If the user hasn't selected a destination,
+# we expect that the disk layout declares it for us.
+DST=${FLAGS_dst:-$(get_fixed_dst_drive)}
+if [ -z "${DST}" ]; then
+  echo "Error: can not determine destination device. Specify --dst yourself."
+  exit 1
 fi
 
 if [ "${DST}" = "/dev/ubi" ]; then