diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-07-20 15:31:37 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-07-20 15:31:37 +0300 |
commit | 84ccd93ddff7193078735c3d947e0f6beecaa07f (patch) | |
tree | 84d232556bf2c7e0453f5c49b70b155660472cf8 /create-vm | |
parent | 2ac152b0a0a90b5061db5ad46d08172ab558704d (diff) | |
download | ansibleness-84ccd93ddff7193078735c3d947e0f6beecaa07f.tar.gz |
Check that base path exists
Diffstat (limited to 'create-vm')
-rwxr-xr-x | create-vm | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -11,6 +11,14 @@ base="$2" # Where are the base images? imagedir="/big/base-images" +# Does the base image exist? +basepath="$imagedir/base-$base.img.xz" +if [ ! -e "$basepath" ] +then + echo "$basepath does not exist" 1>&2 + exit 1 +fi + # How large are the (uncompressed) images? size="4G" @@ -22,7 +30,7 @@ sudo lvcreate --name "$name" --size "$size" "$vg" lvpath="/dev/$vg/$name" # Copy uncompressed image to LV. -unxz < "$imagedir/base-$base.img.xz" | +unxz < "$basepath" | pv --size "$size" | sudo ionice -c3 tee "$lvpath" > /dev/null |