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

Unified Diff: src/scripts/common.sh

Issue 2064001: Move to using chromeos-test to emerge test dependencies in mod_image_for_test. (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: Last upload Created 10 years, 7 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 | « src/scripts/build_image ('k') | src/scripts/mod_image_for_test.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/common.sh
diff --git a/src/scripts/common.sh b/src/scripts/common.sh
index 201679eb4b6c7a0a00df2e65ae7e7da1d58f333a..9121a24f724ac343d222764ca6b1e836adfe021c 100644
--- a/src/scripts/common.sh
+++ b/src/scripts/common.sh
@@ -362,3 +362,44 @@ function safe_umount {
sudo umount -d -l "${path}" || die "Failed to lazily unmount ${path}"
fi
}
+
+# Sets up symlinks for the developer root. It is necessary to symlink
+# usr and local since the developer root is mounted at /usr/local and
+# applications expect to be installed under /usr/local/bin, etc.
+# This avoids packages installing into /usr/local/usr/local/bin.
+# ${1} specifies the symlink target for the developer root.
+# ${2} specifies the symlink target for the var directory.
+# ${3} specifies the location of the stateful partition.
+setup_symlinks_on_root() {
+ # Give args better names.
+ local dev_image_target=${1}
+ local var_target=${2}
+ local dev_image_root="${3}/dev_image"
+
+ # If our var target is actually the standard var, we are cleaning up the
+ # symlinks (could also check for /usr/local for the dev_image_target).
+ if [ ${var_target} = "/var" ]; then
+ echo "Cleaning up /usr/local symlinks for ${dev_image_root}"
+ else
+ echo "Setting up symlinks for /usr/local for ${dev_image_root}"
+ fi
+
+ # Set up symlinks that should point to ${dev_image_target}.
+ for path in usr local; do
+ if [ -h "${dev_image_root}/${path}" ]; then
+ sudo unlink "${dev_image_root}/${path}"
+ elif [ -e "${dev_image_root}/${path}" ]; then
+ die "${dev_image_root}/${path} should be a symlink if exists"
+ fi
+ sudo ln -s ${dev_image_target} "${dev_image_root}/${path}"
+ done
+
+ # Setup var symlink.
+ if [ -h "${dev_image_root}/var" ]; then
+ sudo unlink "${dev_image_root}/var"
+ elif [ -e "${dev_image_root}/var" ]; then
+ die "${dev_image_root}/var should be a symlink if it exists"
+ fi
+
+ sudo ln -s "${var_target}" "${dev_image_root}/var"
+}
« no previous file with comments | « src/scripts/build_image ('k') | src/scripts/mod_image_for_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698