cros_choose_profile: normalize the profile dir argument

If $PWD happens to contain a dir with the same name as the profile,
the "isdir" check passes and we use the value as-is.  The point of
the check though is to look for absolute paths to profiles, so run
the argument through realpath all the time.

BUG=chromium:567959
TEST=`cros_choose_profile --profile=base` works when $PWD has a base dir

Change-Id: I6c9ebea68f0d19c3b840e42eb4e760a69336781d
Reviewed-on: https://chromium-review.googlesource.com/317110
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
diff --git a/host/cros_choose_profile b/host/cros_choose_profile
index a701610..c3e93a5 100755
--- a/host/cros_choose_profile
+++ b/host/cros_choose_profile
@@ -97,7 +97,9 @@
 
 if [ ! -z "${PROFILE_OVERRIDE}" ]; then  # profile specified. must exist or we fail
   if [ -d "${PROFILE_OVERRIDE}" ]; then
-    PROFILES_DIR="${PROFILE_OVERRIDE}"
+    # Make sure we get the full path since we'll be creating a symlink to it.
+    # Relative paths won't work. http://crbug.com/567959
+    PROFILES_DIR=$(realpath "${PROFILE_OVERRIDE}")
   else
     PROFILE_NAME="${PROFILE_OVERRIDE}"
   fi