summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-04-29 15:47:28 +0000
committerBaserock Gerrit <gerrit@baserock.org>2015-05-07 15:02:32 +0000
commit7c360ce448114dd626661e688e0aad3b3754f302 (patch)
tree14581a6b429c066e80b6c93a38b3093866f31925
parent703edae4dc4a284c5710ffa41ed79bd095af8b43 (diff)
downloaddefinitions-7c360ce448114dd626661e688e0aad3b3754f302.tar.gz
Fix sysroot.write trying to overwrite existing files
Commit 807e6a90876c5469d242 changed the behaviour of sysroot.write to avoid deleting the contents of the sysroot. This was done so if you accidentally set 'sysroot=/' it wouldn't delete your whole system. It turns out that SDK deployments like clusters/sdk-example-cluster.morph depended on the contents of the directory being deleted. The system armv7lhf-cross-toolchain-system-x86_64.morph has a bunch of files installed by the cross-toolchain in /usr/armv7lhf-baserock-linux-gnueabi/sys-root. Previously sysroot.write would delete these, but since commit 807e6a90876c5469d242 it would fail with several errors like: mv: can't rename '/src/tmp/deployments/usr/armv7l.../sys-root/sbin' If we use 'cp -a' instead of 'mv' then it is slower to deploy, but there are no errors. I am still unsure why files from the cross-toolchain system are installed and then deleted. Although this patch fixes the immediate issue, I don't know if it's the right thing to do. It seems better to not install those files in the first place, if we do not need them. This commit also removes the check for the sysroot target location being empty. This doesn't work, because it runs /before/ the system being deployed is unpacked. Change-Id: I10671c2f3b2060cfb36f880675b83351c6cdd807
-rwxr-xr-xsysroot.check6
-rwxr-xr-xsysroot.write6
2 files changed, 1 insertions, 11 deletions
diff --git a/sysroot.check b/sysroot.check
index 8ed965bd..71b35175 100755
--- a/sysroot.check
+++ b/sysroot.check
@@ -17,12 +17,6 @@
set -eu
-location="$1"
-if [ -d "$location" ]; then
- echo >&2 "ERROR: Deployment directory already exists: $location"
- exit 1
-fi
-
if [ "$UPGRADE" == "yes" ]; then
echo >&2 "ERROR: Cannot upgrade a sysroot deployment"
exit 1
diff --git a/sysroot.write b/sysroot.write
index 0ad8d630..019edbe9 100755
--- a/sysroot.write
+++ b/sysroot.write
@@ -19,8 +19,4 @@ set -eu
mkdir -p "$2"
-# Move the contents of our source directory to our target
-# Previously we would (cd "$1" && find -print0 | cpio -0pumd "$absolute_path")
-# to do this, but the source directory is disposable anyway, so we can move
-# its contents to save time
-find "$1" -maxdepth 1 -mindepth 1 -exec mv {} "$2/." +
+cp -a "$1/*" "$2"