Simplify standard boilerplate for selected scripts

This shortens the standard boilerplate for finding and sourcing
shell function libraries for build_image, mod_image_for_test.sh and
mod_image_for_recovery.sh.

As a side effect of the change, both mod_image_for_test.sh and
mod_image_for_recovery.sh will now restart inside the chroot if
invoked from outside; this is consistent with the pre-existing
behavior of build_image.

BUG=None
TEST=run the three scripts, from both inside and outside the chroot

Change-Id: Idd91cbee323346a871b49deea31a76875f5ee3c4
Reviewed-on: http://gerrit.chromium.org/gerrit/4675
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Vince Laviano <vlaviano@chromium.org>
4 files changed
tree: f73c801ab9c505be563a85b73d73deb687d42139
  1. .gitignore
  2. archive_build.sh
  3. archive_hwqual
  4. bash_completion
  5. bin/
  6. build_gpt.sh
  7. build_image
  8. build_kernel_image.sh
  9. build_library/
  10. call_autoserv.py
  11. check_control_files.sh
  12. check_deps
  13. chromeos_blacklist
  14. chroot_version_hooks.d/
  15. clean_loopback_devices
  16. common.sh
  17. create_esp.sh
  18. create_legacy_bootloader_templates.sh
  19. cros_deps_diff
  20. cros_download_latest_image
  21. cros_generate_breakpad_symbols
  22. cros_generate_deps_graphs
  23. cros_show_stacks
  24. dot_helper.py
  25. emit_gpt_scripts.sh
  26. enable_localaccount.sh
  27. enter_chroot.sh
  28. fixup_image_for_qemu.py
  29. generate_au_zip.py
  30. get_latest_image.sh
  31. get_package_list
  32. image_to_usb.sh
  33. image_to_vm.sh
  34. lib/
  35. make_developer_script_runner.sh
  36. make_factory_package.sh
  37. make_netboot.sh
  38. make_universal_factory_shim.sh
  39. mk_memento_images.sh
  40. mod_for_factory_scripts/
  41. mod_for_test_scripts/
  42. mod_image_for_recovery.sh
  43. mod_image_for_test.sh
  44. mount_gpt_image.sh
  45. remote_access.sh
  46. run_chroot_version_hooks
  47. serve_factory_packages.py
  48. set_shared_user_password.sh
  49. ssh_test.sh
  50. start_devserver
  51. test_build_root
  52. test_image
  53. update_bootloaders.sh
  54. update_chroot
  55. update_kernel.sh
  56. upload_symbols
  57. verify_rootfs_chksum.sh