Service files for factory reset change - clear instead of delete
This commit adds a new service file to the build which will clear the
contents of a specified UBI volume. It's intended as the backend for the
host factory reset.
Additionally, the service file obmc-flash-bios-ubiumount-prsv.service is
removed. This file removes the volume pnor-prsv. Its only use case - the
factory reset - is changing in this issue, openbmc/openbmc#2322, to
clear that volume instead of deleting it, so there's no reason to keep
the service file around anymore.
Change-Id: I577291e3511bf5234ffb87084a082255dac3dbae
Signed-off-by: Michael Tritz <mtritz@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 f82e6fb..948c6ec 100644
--- a/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
+++ b/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios
@@ -263,6 +263,13 @@
fi
}
+clear_ubi() {
+ mountdir="/media/${name}"
+ if is_mounted "${name}"; then
+ rm -rf $mountdir/..?* $mountdir/.[!.]* $mountdir/*
+ fi
+}
+
case "$1" in
ubiattach)
attach_ubi
@@ -286,6 +293,10 @@
updatesymlinks)
update_symlinks
;;
+ ubiclear)
+ name="$2"
+ clear_ubi
+ ;;
*)
echo "Invalid argument"
exit 1