From 1f7b670993dfb4dfdeead72a812c09958c2b27ec Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Mon, 22 Oct 2012 09:47:57 +0200 Subject: [PATCH 1/2] waagent: fix network manager detection Using dpkg-query -s is more appropriate than using dpkg -l and grep -q. The only way to have 0 returned by dpkg-query -s is to have NM installed and dpkg -l |grep -q may return 1 if the package is not yet known in the base (for instance, right after installing). Signed-off-by: Arnaud Patard --- waagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waagent b/waagent index c6c844087d..caddad89c5 100644 --- a/waagent +++ b/waagent @@ -2126,7 +2126,7 @@ def Install(): if Run("rpm --quiet -q python-pyasn1"): Error(GuestAgentLongName + " requires python-pyasn1.") return 1 - if UsesDpkg() and Run("dpkg -l network-manager | grep -q ^un"): + if UsesDpkg() and not Run("dpkg-query -s network-manager >/dev/null 2>&1"): Error(GuestAgentLongName + " is not compatible with network-manager.") return 1 for a in RulesFiles: From ae14435cf4bab3709cf9ccf83ada6abe1fcd266d Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Tue, 9 Apr 2013 16:34:54 +0200 Subject: [PATCH 2/2] Fix cdrom detection waagent is trying to detect if there's a virtual cdrom by grepping fdisk output, except that the output is different if we're not using en locale. Use LC_ALL=C to make sure we'll have "correct" output Signed-off-by: Arnaud Patard --- waagent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waagent b/waagent index af0cf0cdc2..4004149cad 100644 --- a/waagent +++ b/waagent @@ -1843,7 +1843,7 @@ class Agent(Util): if os.path.exists("/dev/sr0"): dvd = "/dev/sr0" modloaded=False - if Run("fdisk -l " + dvd + " | grep Disk",chk_err=False): + if Run("LC_ALL=C fdisk -l " + dvd + " | grep Disk",chk_err=False): # Is it possible to load a module for ata_piix? retcode,krn=RunGetOutput('uname -r') if retcode: