Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: bin/cros_make_image_bootable

Issue 6240018: This starts to fix the scripts so that they load from /usr/lib/crosutils (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: fixing bad merge Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bin/cros_get_chrome_version ('k') | bin/cros_overlay_list » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_make_image_bootable
diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable
index d5644916b85c8028d51e49b6b916106d2d9a99f3..c1a2d0e2b56926bae6a374b036f2d8dcfef8f77f 100755
--- a/bin/cros_make_image_bootable
+++ b/bin/cros_make_image_bootable
@@ -7,21 +7,35 @@
# Script which ensures that a given image has an up-to-date
# kernel partition, rootfs integrity hashes, and legacy bootloader configs.
-# Load common constants. This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-COMMON_PATH="$(dirname "$0")/../common.sh"
-if [ ! -r "${COMMON_PATH}" ]; then
- echo "ERROR! Cannot find common.sh: ${COMMON_PATH}" 1>&2
- exit 1
-fi
+# --- BEGIN COMMON.SH BOILERPLATE ---
+# Load common CrOS utilities. Inside the chroot this file is installed in
+# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
+# location.
+find_common_sh() {
+ local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..")
+ local path
+
+ SCRIPT_ROOT=
+ for path in "${common_paths[@]}"; do
+ if [ -r "${path}/common.sh" ]; then
+ SCRIPT_ROOT=${path}
+ break
+ fi
+ done
+}
-. "$(dirname "$0")/../common.sh"
+find_common_sh
+. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
+# --- END COMMON.SH BOILERPLATE ---
-# Script must be run inside the chroot.
+# Need to be inside the chroot to load chromeos-common.sh
assert_inside_chroot
+# Load functions and constants for chromeos-install
+. "/usr/lib/installer/chromeos-common.sh" || \
+ die "Unable to load /usr/lib/installer/chromeos-common.sh"
+
set -e
-. "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize
if [ $# -lt 2 ]; then
echo "Usage: ${0} /PATH/TO/IMAGE IMAGE.BIN [shflags overrides]"
@@ -41,7 +55,7 @@ if [ ! -r "${BOOT_DESC_FILE}" ]; then
BOOT_DESC="${@}"
else
BOOT_DESC="$(cat ${BOOT_DESC_FILE} | tr -s '\n' ' ')"
- info "Boot-time configuration for $(dirname ${IMAGE}): "
+ info "Boot-time configuration for $(dirname "${IMAGE}"): "
cat ${BOOT_DESC_FILE} | while read line; do
info " ${line}"
done
@@ -138,7 +152,7 @@ make_image_bootable() {
fi
trap "mount_gpt_cleanup" EXIT
- ${SCRIPTS_DIR}/mount_gpt_image.sh --from "$(dirname ${image})" \
+ "${SCRIPTS_DIR}/mount_gpt_image.sh" --from "$(dirname "${image}")" \
--image "$(basename ${image})" -r "${FLAGS_rootfs_mountpoint}" \
-s "${FLAGS_statefulfs_mountpoint}"
« no previous file with comments | « bin/cros_get_chrome_version ('k') | bin/cros_overlay_list » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698