installerfw-sh-functions: add missing newlines
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 14 Feb 2014 16:01:58 +0000 (18:01 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 14 Feb 2014 16:13:51 +0000 (18:13 +0200)
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>
installerfw-sh-functions

index 1316f8e3c8b96f2b93ff9a0c954d31a61b03b498..491e072e2892232f1229d3a5d925f26dd18be3b4 100644 (file)
@@ -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\""