-function is_partition(){
- device=$1
- if [ -e $SYS_BLOCK/$device/partition ];then
- return 0
- else
- return 1
- fi
-}
-
-function is_removable(){
- device=$1
- sysdev=$SYS_BLOCK/$device
- if ( is_partition $device );then
- removable=$(readlink -f $sysdev/..)/removable
- else
- removable=$sysdev/removable
- fi
- if [ -e $removable ] && [ $(cat $removable) -eq 1 ];then
- return 0
- else
+if ( grep -q "^flags.*hypervisor" /proc/cpuinfo ); then
+ echo "Not excuting in Virtual machine"
+else
+ function is_partition(){
+ device=$1
+ if [ -e $SYS_BLOCK/$device/partition ];then
+ return 0
+ else
+ return 1
+ fi
+ }
+
+ function is_removable(){
+ device=$1
+ sysdev=$SYS_BLOCK/$device
+ if ( is_partition $device );then
+ removable=$(readlink -f $sysdev/..)/removable
+ else
+ removable=$sysdev/removable
+ fi
+ if [ -e $removable ] && [ $(cat $removable) -eq 1 ];then
+ return 0
+ else
+ return 1
+ fi
+
+ }
+
+ function is_loop(){
+ device=$1
+ if [ -e $SYS_BLOCK/$device/loop ]; then
+ return 0
+ fi