From 5168e38e6397dc7285138a453af0461363dad262 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 14 Feb 2014 18:01:58 +0200 Subject: [PATCH] installerfw-sh-functions: add missing newlines 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 --- installerfw-sh-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installerfw-sh-functions b/installerfw-sh-functions index 1316f8e..491e072 100644 --- a/installerfw-sh-functions +++ b/installerfw-sh-functions @@ -80,12 +80,12 @@ installerfw_save_env() 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\"" -- 2.7.4