Bash - Saber Si El Sistema Es Físico O Virtual


Subject: Bash - Saber Si El Sistema Es Físico O Virtual
Hola a todos.
A veces en los scripts que uso para instalar los sistemas nuevos, con el fin de ahorrar el trabajo en lo que atañe a instalar paquetes usuales y la configuración, me he topado con que si estoy instalando un sistema virtual no me interesa agregar virtualbox, por ejemplo, asi que retocaba el script a mano comentando las lineas.
Pero aqui planteo una solucion algo mas elegante

Primero determinando el tipo de maquina
SYSVIRT=`dmesg | grep "Hypervisor detected"`
if [ -n $SYSVIRT ];then
SYSVIRT="HARD"
else
SYSVIRT="VIRT"
fi

Y luego actuando en consecuencia
case $SYSVIRT in
"HARD")
sudo apt-get install -y virtualbox
esac


Saludos.

Profile PM  
Subject: Re: Bash - Saber Si El Sistema Es Físico O Virtual
+1

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Generation Time: 0.0807s (PHP: -35% SQL: 135%)
SQL queries: 23 - Debug Off - GZIP Enabled