diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-04-29 15:47:28 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-05-07 15:02:32 +0000 |
commit | f6e36277bb06620f1f25ef10caed950fa22c1f5b (patch) | |
tree | ca4922c5ad02d1d22cef2437e2a0e5ecb3db6f9c /morphlib/exts | |
parent | e08f3e317dfa91e082506a0e89aca5c0d7af7380 (diff) | |
download | morph-f6e36277bb06620f1f25ef10caed950fa22c1f5b.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
Diffstat (limited to 'morphlib/exts')
-rwxr-xr-x | morphlib/exts/sysroot.check | 6 | ||||
-rwxr-xr-x | morphlib/exts/sysroot.write | 6 |
2 files changed, 1 insertions, 11 deletions
diff --git a/morphlib/exts/sysroot.check b/morphlib/exts/sysroot.check index 8ed965bd..71b35175 100755 --- a/morphlib/exts/sysroot.check +++ b/morphlib/exts/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/morphlib/exts/sysroot.write b/morphlib/exts/sysroot.write index 0ad8d630..019edbe9 100755 --- a/morphlib/exts/sysroot.write +++ b/morphlib/exts/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" |