Advertisement
vonschutter

kvm-init

Apr 27th, 2021
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.09 KB | None | 0 0
  1.     count=1
  2.     for i in qemu-utils qemu-tools qemu-kvm qemu-system-x86 virt-install
  3.     do
  4.         write_status "${count}  - Verifying dependencies ( ${i} )..."
  5.         check_dependencies $i &>/dev/null
  6.         count=$((count + 1))
  7.     done
  8.  
  9.     # Lookup specific binaries: use full path since they may just have been added and not in $PATH yet.
  10.     : "${BIN_VIRT_INSTALL:=$(type -p virt-install)}"
  11.  
  12.     # Discover if the appropriate VM net interface is (default or br'0 - n')
  13.     VIRT_NET="$(if ls /sys/class/net |grep br |grep -v virbr >/dev/null; then echo "bridge:$(ls /sys/class/net)" |grep br ; else echo default;fi)"
  14.  
  15.     # create image and run installer
  16.     "${BIN_VIRT_INSTALL}" --name VDI_Ubuntu_"$CONFIG"_"$RANDOM" \
  17.         --vcpus "${2:-2}" \
  18.         --memory "${3:-2048}" \
  19.         --network "${VIRT_NET}" \
  20.         --disk size="${4:-30}" \
  21.         --os-variant="${1:-debian10}" \
  22.         --location=http://us.archive.ubuntu.com/ubuntu/dists/hirsute/main/uefi/linux-oem-amd64/current/ \
  23.         --initrd-inject="$PRESEED_FILE" \
  24.         --extra-args "ks=file:/$(basename $PRESEED_FILE)" \
  25.         --noautoconsole || read -p "An ERROR has occurred. Please press [ENTER] to continue..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement