processBMCImage: Dynamically calculate version id

With the UBI layout, the name of the mount directories have the
version id because the UBI volume names have the id so it's
easy to get.

With other layouts where static partition names are used, the id
is not part of the partition name so it can only be calculated
from the version string, which requires to mount the filesystem
to read it from the os-release file.

Change the logic to have processBMCImage() calculate the id from
the version string for each mounted filesystem instead of the
mount directory name, as long as the mount directory name starts
with BMC_ROFS_PREFIX, ex: /media/rofs-a. The current UBI mount
directory names rofs-<id> continue to work, just the directory
name is not used anymore to get the id.

If the os-release file is not found or does not contain a version
string, assume it's corrupted and attempt to get the id from the
mount directory name.

Tested: Verified in witherspoon that the d-bus objects are
        created with the expected version ids.

Change-Id: Iff0103c9cbd060c7fb49ff29c48a72f2873f0f32
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
1 file changed