Check if the BMC version already exists in /media before mounting.

- When a system is first flashed, it has 2 rofs-0 mounts, since both
  chips have the same version.
- This change would help prevent the 2nd mount since the BMC version
  is already mounted.

Resolves openbmc/openbmc#2307

Change-Id: I50c7df3deb953b411aa6ff9929907f3879c6e130
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index 116b486..d0dca1c 100644
--- a/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -196,9 +196,12 @@
 
       if [[ ${name} == rofs-* ]]; then
         mountdir="/media/${name}"
-        mkdir -p "${mountdir}"
-        ubiblock --create /dev/ubi${mtd}_${element} &> /dev/null
-        mount -t squashfs -o ro "/dev/ubiblock${mtd}_${element}" "${mountdir}"
+
+        if [ ! -d ${mountdir} ]; then
+          mkdir -p "${mountdir}"
+          ubiblock --create /dev/ubi${mtd}_${element} &> /dev/null
+          mount -t squashfs -o ro "/dev/ubiblock${mtd}_${element}" "${mountdir}"
+        fi
       fi
     done
   done