Clear PNOR patch location while updating symlinks
- If the user has activated a new image, then clear all
PNOR patches under /usr/local/share/pnor/ before the
new HOST version powers on (i.e. during symlink updates).
Resolves openbmc/openbmc#2273
Change-Id: I3ce3709a6813beaac812f3d1c00b065bad04d2fe
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
index fdc7e3c..f82e6fb 100644
--- a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
+++ b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
@@ -213,6 +213,7 @@
PNOR_PRSV_ACTIVE_PATH="/var/lib/phosphor-software-manager/pnor/prsv"
PNOR_PRSV="/media/pnor-prsv"
PERSISTENCE_PATH="/var/lib/obmc/openpower-pnor-code-mgmt/"
+ PNOR_PATCH_LOCATION="/usr/local/share/pnor/"
# Get a list of all active PNOR versions
data="$(ls -d ${PNOR_RO_PREFIX}*)"
@@ -248,6 +249,7 @@
# lowest priority, then remove the symlink and create new ones.
if [[ $(readlink -f "${PNOR_RO_ACTIVE_PATH}") != ${PNOR_RO_PREFIX}${currentVersion} ]]; then
rm -f ${PNOR_RO_ACTIVE_PATH}
+ rm -rf ${PNOR_PATCH_LOCATION}*
ln -sfv ${PNOR_RO_PREFIX}${currentVersion} ${PNOR_RO_ACTIVE_PATH}
fi