aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-13 20:58:42 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-13 20:58:42 -0300
commit0ff32d1b9736da827f0476951b72a07b20d49cdf (patch)
treef7e18d6d765db647608f8eca897414524e22a8d7
parenta7af79ef6aa999481425a6ec58f8e75b55216760 (diff)
downloadkvmx-0ff32d1b9736da827f0476951b72a07b20d49cdf.tar.gz
kvmx-0ff32d1b9736da827f0476951b72a07b20d49cdf.tar.bz2
Fix image packing and dest folder permissions at kvmx-create
-rwxr-xr-xkvmx-create22
1 files changed, 14 insertions, 8 deletions
diff --git a/kvmx-create b/kvmx-create
index 0375cf6..e98f29a 100755
--- a/kvmx-create
+++ b/kvmx-create
@@ -366,18 +366,24 @@ EOF
# Umount image
kvmx_sudo_run umount $WORK
kvmx_sudo_run rmdir $WORK
- kvmx_sudo_run losetup -d $device
- # Image conversion
- if [ "$format" == "qcow2" ]; then
- echo "Converting raw image to qcow2..."
- kvmx_sudo_run mv $image $image.raw
- kvmx_sudo_run qemu-img convert -O qcow2 -p $compression ${image}.raw $image
- kvmx_sudo_run rm ${image}.raw
+ # Pack guest image
+ if [ -z "$image_type" ] || [ "$image_type" == "file" ]; then
+ kvmx_sudo_run losetup -d $device
+
+ # Image conversion
+ if [ "$format" == "qcow2" ]; then
+ echo "Converting raw image to qcow2..."
+ kvmx_sudo_run mv $image $image.raw
+ kvmx_sudo_run qemu-img convert -O qcow2 -p $compression ${image}.raw $image
+ kvmx_sudo_run rm ${image}.raw
+ fi
fi
# Fix permissions
- kvmx_sudo_run chown -R `whoami`. `dirname $image`
+ if [ "`whoami`" != "root" ]; then
+ kvmx_sudo_run chown -R `whoami`. `dirname $image`
+ fi
}
# Second stage procedure