This repository has been archived on 2020-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
docker-linux-vm/install.sh

38 lines
954 B
Bash
Raw Normal View History

2019-11-13 04:02:24 +00:00
#!/bin/bash
2019-11-13 05:20:55 +00:00
function wait_for_finish() {
echo "Waiting for install to finish..."
while sleep 10 ; do
STATUS="$(virsh dominfo linux | grep State | awk -F' ' '{print $2}')"
if [[ "x$STATUS" == "xrunning" ]]; then
date -u
echo "Still waiting for install to finish..."
fi
if [[ "x$STATUS" != "xrunning" ]]; then
2019-11-14 04:28:48 +00:00
date -u
2019-11-13 05:20:55 +00:00
echo "Install done."
return
fi
done
}
2019-11-14 04:28:48 +00:00
function begin_install_os() {
2019-11-13 04:02:24 +00:00
virsh list
virt-install --virt-type qemu --name linux \
--ram 4096 \
2019-11-13 05:20:55 +00:00
--disk path=image.qcow2 \
2019-11-13 04:02:24 +00:00
--os-variant ubuntu18.04 \
--initrd-inject=preseed.cfg \
--initrd-inject=postinst.sh \
--graphics none \
--location 'http://us.archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
2019-11-13 05:20:55 +00:00
#virsh list
#virsh console linux
2019-11-13 04:02:24 +00:00
}
2019-11-13 05:20:55 +00:00
begin_install_os
wait_for_finish
exit 0