Advertisement
Guest User

Untitled

a guest
Apr 10th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.22 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. imgfile=$1
  4.  
  5. vmname=$2
  6. if [ -z "$vmname" ]; then
  7.     vmname="BuildStream"
  8. fi
  9.  
  10. vdifile=${vmname}.vdi
  11.  
  12. if [ -e "$vdifile" ]; then
  13.     echo "File already exists: $vdifile"
  14.     exit 1
  15. fi
  16.  
  17. # Convert the raw image to VDI format
  18. VBoxManage convertdd ${imgfile} ${vdifile} --format VDI
  19.  
  20. # Create a blank vm (you can use --basefolder option to choose to put it
  21. # somewhere specific rather than in the default Virtualbox VMs folder)
  22. VBoxManage createvm --name $vmname --ostype Linux_64 --register
  23.  
  24. # Set up memory, networking and other hardware. The `bridegadapter1` argument must be an active network interface
  25. VBoxManage modifyvm $vmname --ioapic on --memory 2048 --nic1 bridged --bridgeadapter1 en0
  26.  
  27. # If your host machine cpu has multiple cores, now would be a good time to
  28. # configure your VM to use them - for a machine with 4 cores
  29. VBoxManage modifyvm $vmname --cpus 4
  30.  
  31. # Add a SATA controller:
  32. VBoxManage storagectl $vmname --name "SATA Controller" --add sata --bootable on --portcount 2
  33.  
  34. # Attach the hard disc to the image file you downloaded
  35. VBoxManage storageattach $vmname --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ${vdifile}
  36.  
  37. # Start it up:
  38. # VBoxManage startvm $vmname
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement