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.
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
|
|
|
|
echo "Install done."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-11-13 04:02:24 +00:00
|
|
|
function install_os() {
|
|
|
|
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
|