recovery-initramfs: correctly set environment variables containing spaces

In the libubootenv implementation of fw_setenv, multiple variables can be set
in one call. When setting a variable with a space-separated list, the app
interprets the list as new variable/value tuples, for example:

    fw_setenv myvar value1 value2 value3

Results in:

    myvar=value1
    value2=value3

This was causing the encrypted eMMC partition mechanism to break, because the
list of encrypted partitions is stored as a space-separated list in an
environment variable. Avoid this by enclosing the variable argument of
set_uboot_var() with double quotes.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2021-06-01 09:41:18 +02:00
parent 05a1dfb84e
commit 94551f0c4d
1 changed files with 1 additions and 1 deletions

View File

@ -110,7 +110,7 @@ read_uboot_var() {
# @param ${2} - Value to set.
#------------------------------------------------------------------------------
set_uboot_var() {
fw_setenv ${1} ${2} 2>/dev/null
fw_setenv ${1} "${2}" 2>/dev/null
}
#------------------------------------------------------------------------------