Simplify disk setup process

This commit is contained in:
j3s 2020-10-22 18:34:09 -05:00
parent c0d93d3db8
commit f02974eb5a
1 changed files with 2 additions and 3 deletions

View File

@ -5,8 +5,7 @@
# POSIX or die
vmname="$1"
# resolve the .qcow2 symlink so backing images never change
template_file="/tank/img/$(readlink /tank/img/$2)"
template_file="/tank/img/$2"
vcpus="$3"
memory="$4"
pubkeys="$5"
@ -48,7 +47,7 @@ if [ -f /tank/vm/$vmname.qcow2 ]; then
exit 1
fi
qemu-img create -f qcow2 -b "$template_file" "$disk"
cp "$template_file" "$disk"
cp /tank/config/cyberia-cloudinit.yml /tmp/cloudinit.yml
echo "$pubkeys" | while IFS= read -r line; do
echo " - $line" >> /tmp/cloudinit.yml