cros_workon_make: Do not fail on first run.

cros_workon_make just after emerge (or build_packages) will cause an error:

sed: can't read /build/volteer/tmp/portage/chromeos-base/debugd-9999/temp/environment: No such file or directory

Skip patching the environment file when it doesn't exist.

BUG=chromium:1212997
TEST=FEATURES="test" emerge-volteer debugd && \
  cros_workon_make --test --board=volteer debugd
  # says WARN: Forcing reinitialization for the first time
  # instead.

Change-Id: I5f79931eb658556faa04cf5e79b7a02302015989
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2929803
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Tested-by: Junichi Uekawa <uekawa@chromium.org>
diff --git a/cros_workon_make b/cros_workon_make
index 97da13c..8ddb90b 100755
--- a/cros_workon_make
+++ b/cros_workon_make
@@ -143,10 +143,12 @@
 else
   rm -f "${workpath}/.compiled"
   envf="${workpath}/temp/environment"
-  for v in ${PASS_THROUGH_VARS[@]}; do
-    # We delete it independently in case the var wasn't set initially.
-    sed -i -e "/^declare .. ${v}=/d" "${envf}"
-    printf 'declare -x %s="%s"\n' "${v}" "${!v}" >> "${envf}"
-  done
+  if [[ -f "${envf}" ]]; then
+    for v in ${PASS_THROUGH_VARS[@]}; do
+      # We delete it independently in case the var wasn't set initially.
+      sed -i -e "/^declare .. ${v}=/d" "${envf}"
+      printf 'declare -x %s="%s"\n' "${v}" "${!v}" >> "${envf}"
+    done
+  fi
 fi
 exec "${EBUILDCMD}" "${pkgfile}" ${clean} "${to_do}"