diff options
-rwxr-xr-x | xci/scripts/vm/build-dib-os.sh | 8 | ||||
-rwxr-xr-x | xci/scripts/vm/start-new-vm.sh | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/xci/scripts/vm/build-dib-os.sh b/xci/scripts/vm/build-dib-os.sh index 7547d40e..7688ee6e 100755 --- a/xci/scripts/vm/build-dib-os.sh +++ b/xci/scripts/vm/build-dib-os.sh @@ -24,17 +24,21 @@ fi # Prepare new working directory dib_workdir="${XCI_CACHE_DIR:-${HOME}/.cache/opnfv_xci_deploy}/clean_vm/images" [[ ! -d $dib_workdir ]] && mkdir -p $dib_workdir -chmod 777 -R $dib_workdir # Record our information uid=$(id -u) gid=$(id -g) +sudo chmod 777 -R $dib_workdir +sudo chown $uid:$gid -R $dib_workdir + echo "Getting the latest docker image..." eval $docker_cmd pull hwoarang/docker-dib-xci:latest # Get rid of stale files -rm -rf $dib_workdir/*.qcow2 $dib_workdir/*.sha256.txt $dib_workdir/*.d +rm -rf $dib_workdir/${ONE_DISTRO}.qcow2 \ + $dib_workdir/${ONE_DISTRO}.sha256.txt \ + $dib_workdir/${ONE_DISTRO}.d echo "Initiating dib build..." eval $docker_cmd run --name ${docker_name} \ --rm --privileged=true -e ONE_DISTRO=${ONE_DISTRO} \ 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 |