diff options
author | Michael Tritz <mtritz@us.ibm.com> | 2017-09-21 08:41:15 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-10-03 23:26:20 +0300 |
commit | ed6d7b07832f7a9e32a7dc2ac3afb7b35608c8d3 (patch) | |
tree | 08943e2190fe995c83ed7f21ece79adad03b5977 /meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc | |
parent | b457009fdb07e9f08d65e48ddb7b181beca0a35c (diff) | |
download | openbmc-ed6d7b07832f7a9e32a7dc2ac3afb7b35608c8d3.tar.xz |
Service files to remove orphaned UBI volumes
This commit provides supplementary service files for
openbmc/openbmc#2264, which adds a function to delete all versions to
each of the BMC and host updaters.
The service files introduced in this change will locate any "orphaned"
BMC or host volumes - that is to say, volumes which do not correspond to
a current version on the system.
Change-Id: If324d24f66ba08fb0b76ca5873addb6bf2446f97
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc')
-rw-r--r-- | meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc index d8eed5732..2025a05f3 100644 --- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc +++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc @@ -192,6 +192,26 @@ ubi_remove() { fi } +ubi_cleanup() { + # When ubi_cleanup is run, it expects one or no active version. + activeVersion=$(busctl --list --no-pager tree \ + xyz.openbmc_project.Software.BMC.Updater | \ + grep /xyz/openbmc_project/software/ | tail -c 9) + + if [[ -z "$activeVersion" ]]; then + vols=$(ubinfo -a | grep -e "kernel-" -e "rofs-" | cut -c 14-) + vols=(${vols}) + else + vols=$(ubinfo -a | grep -e "kernel-" -e "rofs-" | \ + grep -v "$activeVersion" | cut -c 14-) + vols=(${vols}) + fi + + for (( index=0; index<${#vols[@]}; index++ )); do + ubi_remove ${vols[index]} + done +} + remount_ubi() { bmcmtd="$(findmtd "bmc")" altbmcmtd="$(findmtd "alt-bmc")" @@ -346,6 +366,9 @@ case "$1" in name="$2" ubi_remove "${name}" ;; + ubicleanup) + ubi_cleanup + ;; ubisetenv) ubi_setenv "$2" ;; |