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

Unified Diff: src/scripts/common.sh

Issue 2075019: Cleanup of adding pristine image and fixing of symlinks in developer image. (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: 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
Index: src/scripts/common.sh
diff --git a/src/scripts/common.sh b/src/scripts/common.sh
index 1023d480c7c76bba78f725647f0d426271e9f938..acd310d3eb697844461cdab5c913d6153fd16598 100644
--- a/src/scripts/common.sh
+++ b/src/scripts/common.sh
@@ -369,6 +369,26 @@ function safe_umount {
fi
}
+# Fixes symlinks that are incorrectly prefixed with the build root ${1}
+# rather than the real running root '/'.
+# TODO(sosa) - Merge setup - cleanup below with this method.
+fix_broken_symlinks() {
+ local build_root="${1}"
+ local symlinks=$(find "${build_root}/usr/local" -lname "${build_root}/*")
+ for symlink in ${symlinks}; do
+ echo "Fixing ${symlink}"
+ local target=$(ls -l "${symlink}" | cut -f 2 -d '>')
+ # Trim spaces from target (bashism).
+ target=${target/ /}
+ # Make new target (removes rootfs prefix).
+ new_target=$(echo ${target} | sed "s#${build_root}##")
+
+ echo "Fixing symlink ${symlink}"
+ sudo unlink "${symlink}"
+ sudo ln -sf "${new_target}" "${symlink}"
+ done
+}
+
# 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.

Powered by Google App Engine
This is Rietveld 408576698