alibaba-cloud: Make the test more robust
[virt-what.git] / virt-what.in
index 550de00..ad82e22 100644 (file)
@@ -116,7 +116,7 @@ arch=$(uname -m | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/')
 # Check for Alibaba Cloud
 if echo "$dmi" | grep -q 'Manufacturer: Alibaba'; then
     # Check for Alibaba Cloud ECS Bare Metal (EBM) Instance
-    if ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
+    if [ "x$root" = "x" ] && ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
         echo "alibaba_cloud-ebm"
     else
         echo "alibaba_cloud"