otter: add flash script

Change-Id: Ic3961ca8944561de283c02458c7818544a897d5f
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/otter/flash.sh b/otter/flash.sh
new file mode 100644
index 0000000..e9b330d
--- /dev/null
+++ b/otter/flash.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+SCRIPTPATH="$(
+    cd -- "$(dirname "$0")" >/dev/null 2>&1 || {
+        echo "Could not check script path"
+        exit 1
+    }
+    pwd -P
+)"
+
+IMAGES=(
+    abl
+    aop
+    bluetooth
+    cpucp
+    devcfg
+    dsp
+    featenabler
+    hyp
+    imagefv
+    keymaster
+    modem
+    multiimgoem
+    qupfw
+    shrm
+    tz
+    uefisecapp
+    xbl
+    xbl_config
+)
+
+for image in "${IMAGES[@]}"; do
+    IMAGE_PATH="${SCRIPTPATH}/radio/${image}.img"
+    if [ ! -f "${IMAGE_PATH}" ]; then
+        echo "ERROR: ${IMAGE_PATH} does not exist!"
+        echo "Aborting flash procedure"
+        exit 1
+    fi
+done
+
+for image in "${IMAGES[@]}"; do
+    IMAGE_PATH="${SCRIPTPATH}/radio/${image}.img"
+    fastboot flash "${image}" "${IMAGE_PATH}"
+done