[DRE-commits] [vagrant-libvirt] 114/163: Print proper paths to user when using a absolute BOX path.

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:57:13 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 d84efc301a88dfce708290050f371b6241253be9
Author: Jakob Aarøe Dam <jakob.a.dam at gmail.com>
Date:   Thu Feb 19 08:58:49 2015 +0100

    Print proper paths to user when using a absolute BOX path.
---
 tools/create_box.sh | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/create_box.sh b/tools/create_box.sh
index a16283c..cf401be 100755
--- a/tools/create_box.sh
+++ b/tools/create_box.sh
@@ -25,6 +25,12 @@ rebase(){
     [[ "$?" -ne 0 ]] && error "Error during rebase"
 }
 
+# Is absolute path
+isabspath(){
+    local path=${1}
+    [[ $path =~ ^/.* ]]
+}
+
 if [ -z "$1" ]; then
     usage
     exit 1
@@ -42,7 +48,7 @@ if [[ -z "$2" ]]; then
     BOX=$BOX_NAME.box
 else
     BOX="$2"
-    BOX_NAME=${BOX%.*}
+    BOX_NAME=$(basename ${BOX%.*})
 fi
 
 [[ -f "$BOX" ]] && error "'$BOX': Already exists"
@@ -94,8 +100,12 @@ EOF
 echo "==> Creating box, tarring and gzipping"
 
 tar cvzf $BOX --totals ./metadata.json ./Vagrantfile ./box.img
-mv $BOX $CWD
 
-echo "==> ${CWD}/${BOX} created"
+# if box is in tmpdir move it to CWD before removing tmpdir
+if ! isabspath $BOX; then
+    mv $BOX $CWD
+fi
+
+echo "==> ${BOX} created"
 echo "==> You can now add the box:"
 echo "==>   'vagrant box add ${BOX} --name ${BOX_NAME}'"

-- 
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