-1

I am trying to automate the installation of Ubuntu from a network repository. I am now successfully able to configure the ISO image and it does the installation automatically.

My requirement:

I would like to know if there is a method in the initial installation stage of Ubuntu, where I can tell if the OS is being installed in VirtualBox or a physical desktop. I want this check to be performed as I want to automate the installation of the VirtualBox guest additions if the installation is being performed in VirtualBox.

How can I do this?

LogicIO
  • 101

1 Answers1

4

If you're only checking for VirtualBox and don't need to cater for all hypervisors, there's a quick and dirty way - check for the presence of VirtualBox devices.

lshw | grep VirtualBox
lspci | grep VirtualBox

I'm not sure if you'll have either or both of lshw and lspci but you can always install them as part of your custom installation (or, check the contents of /proc/pci instead of using lspci).

mjturner
  • 7,300