Make sure the /etc/installerfw-environment contains the newline character at
the end. It is reasonable to expect the newline character at the end of text
files.
Additionally, fix code which calculates the lines count. We forgot the newline
character, which will make 'wc -l' return an off-by-one number.
Change-Id: I0e8f36f2be8e7b31a21ce1c6449bf23bb4f9d238
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
local variables="$(printenv | eval "LC_ALL=C grep $opts")"
- if [ "$(printf "%s" "$variables" | wc -l)" -eq "0" ]; then
+ if [ "$(printf "%s\n" "$variables" | wc -l)" -eq "0" ]; then
__fatal "no installer framework environment variables" \
"found, nothing to save"
fi
- printf "%s" "$variables" | LC_ALL=C sed -n -e \
+ printf "%s\n" "$variables" | LC_ALL=C sed -n -e \
"s/\(^INSTALLERFW_[^=]\+\)=\(.*\)/\1=\"\2\"/p" > "$file"
__verbose "installerfw_save_env(): saved installer framework" \
"environment in \"$file\""