factory_install: Move environment setup to factory_install_service.sh

Factory installer may be started by either upstart job or directly from
initramfs (in netboot mode), so the environment detection and setup code
should be a standalone shell script that can be shared by both installations.

BUG=chromium:443972
TEST=Boots factory install shim.

Change-Id: I7254e211f63504a7645ce622f11f73c41493bbbc
Reviewed-on: https://chromium-review.googlesource.com/248050
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2 files changed