build_image: symlink bash if it is installed on stateful-dev

For cros_embeeded, bash is not part of the base image. But emerge
requires that it be present at /bin/bash. Fix this, by creating
a symlink.

BUG=chromium-os:39300
TEST=ls -l /build/daisy-drm/bin/bash

Change-Id: I68fdfb59bb6d916f5790833d45f8d69da208e76a
Reviewed-on: https://gerrit.chromium.org/gerrit/44273
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Mandeep Singh Baines <msb@chromium.org>
diff --git a/build_library/dev_image_util.sh b/build_library/dev_image_util.sh
index 5146be4..3406e08 100755
--- a/build_library/dev_image_util.sh
+++ b/build_library/dev_image_util.sh
@@ -104,6 +104,13 @@
     done
   fi
 
+  # If bash is not installed on rootfs, we'll need a  bash symlink.
+  # Otherwise, emerge won't work.
+  if [[ ! -e "${root_fs_dir}"/bin/bash ]]; then
+    info "Fixing bash path for developer and test images."
+    sudo ln -sf /usr/local/bin/bash "${root_fs_dir}"/bin/bash
+  fi
+
   info "Developer image built and stored at ${image_name}"
 
   cleanup_mounts