Enable environment variable deletion from obmc-flash-bmc-setenv@.service
This commit extends the functionality of obmc-flash-bmc-setenv@.service,
which calls upon the obmc-flash-bmc script to set an environment
variable.
When working with environment variables in the shell, one can set OR
clear a particular variable using the fw_setenv command. This commit
expands the functionality of the service file to match.
If a name-value pair is specified, this script will set the environment
variable as given. If a name is supplied with no value, the environment
variable with that name will be cleared.
Change-Id: I2eed0148957363668600986f56cb9e678caf855c
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
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 73f7b51..8d49f50 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
@@ -217,9 +217,13 @@
ubi_setenv() {
variable=$1
- varName="${variable%=*}"
- value="${variable##*=}"
- fw_setenv "$varName" "$value"
+ if [[ "$variable" == *"="* ]]; then
+ varName="${variable%=*}"
+ value="${variable##*=}"
+ fw_setenv "$varName" "$value"
+ else
+ fw_setenv "$variable"
+ fi
}
mtd_write() {