[DRE-commits] [vagrant-libvirt] 122/163: Check for write permission to image before boxing.

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:57:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag 0.0.26
in repository vagrant-libvirt.

commit e7c7d70c3a914415306ef596b4089cb52f511b2f
Author: Jakob Aarøe Dam <jakob.a.dam at gmail.com>
Date:   Tue Mar 17 10:27:04 2015 +0100

    Check for write permission to image before boxing.
---
 tools/create_box.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/create_box.sh b/tools/create_box.sh
index d691a03..3a2f631 100755
--- a/tools/create_box.sh
+++ b/tools/create_box.sh
@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+#set -xu
 
 error() {
     local msg="${1}"
@@ -59,6 +60,8 @@ TMP_IMG="$TMP_DIR/box.img"
 
 mkdir -p "$TMP_DIR"
 
+[[ ! -w "$IMG" ]] && error "'$IMG': Permission denied"
+
 # We move / copy (when the image has master) the image to the tempdir
 # ensure that it's moved back / removed again
 if [[ -n $(backing "$IMG") ]]; then
@@ -67,6 +70,7 @@ if [[ -n $(backing "$IMG") ]]; then
     cp "$IMG" "$TMP_IMG"
     rebase "$TMP_IMG"
 else
+    # move the image to get a speed-up and use less space on disk
     trap 'mv "$TMP_IMG" "$IMG"; rm -rf "$TMP_DIR"' EXIT
     mv "$IMG" "$TMP_IMG"
 fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git



More information about the Pkg-ruby-extras-commits mailing list