diff options
author | 2017-10-05 10:01:09 +0100 | |
---|---|---|
committer | 2017-10-05 15:31:23 +0100 | |
commit | dfd9229ad20d0ff724ce5ccf45161c8eb5e2c9e5 (patch) | |
tree | feee0142a4b028069e4fd05fbd037a6b93545007 /xci/scripts/vm/start-new-vm.sh | |
parent | a934224aed505efe524a9a4c2db3b917e5addfef (diff) |
xci: scripts: build-dib-os.sh: chmod and chown files using sudo
Some of the files may be owned by root so we need to ensure that
everything is reset properly. Moreover, only clean the image files
for the one we are building.
Change-Id: I45b78db6715534187f19d9f513e8288fd076cb6b
Signed-off-by: Markos Chandras <mchandras@suse.de>
Diffstat (limited to 'xci/scripts/vm/start-new-vm.sh')
-rwxr-xr-x | xci/scripts/vm/start-new-vm.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/xci/scripts/vm/start-new-vm.sh b/xci/scripts/vm/start-new-vm.sh index 4ad41f64..a1f4080e 100755 --- a/xci/scripts/vm/start-new-vm.sh +++ b/xci/scripts/vm/start-new-vm.sh @@ -110,6 +110,11 @@ sudo systemctl -q start docker echo "Preparing XCI cache..." mkdir -p ${XCI_CACHE_DIR}/ ${XCI_CACHE_DIR}/clean_vm/images/ +# Record our information +uid=$(id -u) +gid=$(id -g) +sudo chmod 777 -R $XCI_CACHE_DIR/clean_vm/images/ +sudo chown $uid:$gid -R $XCI_CACHE_DIR/clean_vm/images/ if ${XCI_BUILD_CLEAN_VM_OS}; then echo "Building new ${OS} image..." @@ -132,6 +137,9 @@ fi # Doesn't matter if we just built an image or got one from artifacts. In both # cases there should be a copy in the cache so copy it over. sudo rm -f ${BASE_PATH}/${OS}.qcow2 +# Fix perms again... +sudo chmod 777 -R $XCI_CACHE_DIR/clean_vm/images/ +sudo chown $uid:$gid -R $XCI_CACHE_DIR/clean_vm/images/ cp ${XCI_CACHE_DIR}/clean_vm/images/${OS}.qcow2 ${BASE_PATH}/ declare -r OS_IMAGE_FILE=${OS}.qcow2 |