You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

38 lines
954B

  1. #!/bin/bash
  2. function wait_for_finish() {
  3. echo "Waiting for install to finish..."
  4. while sleep 10 ; do
  5. STATUS="$(virsh dominfo linux | grep State | awk -F' ' '{print $2}')"
  6. if [[ "x$STATUS" == "xrunning" ]]; then
  7. date -u
  8. echo "Still waiting for install to finish..."
  9. fi
  10. if [[ "x$STATUS" != "xrunning" ]]; then
  11. date -u
  12. echo "Install done."
  13. return
  14. fi
  15. done
  16. }
  17. function begin_install_os() {
  18. virsh list
  19. virt-install --virt-type qemu --name linux \
  20. --ram 4096 \
  21. --disk path=image.qcow2 \
  22. --os-variant ubuntu18.04 \
  23. --initrd-inject=preseed.cfg \
  24. --initrd-inject=postinst.sh \
  25. --graphics none \
  26. --location 'http://us.archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/' \
  27. --extra-args 'console=ttyS0,115200n8 serial'
  28. #virsh list
  29. #virsh console linux
  30. }
  31. begin_install_os
  32. wait_for_finish
  33. exit 0