Commit 77780f79 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: buildtar: do not print successful message if tar returns error

The previous commit spotted that "Tarball successfully created ..."
is displayed even if the "tar" command returns error code because
it is followed by "| ${compress}".

Let the build fail instead of printing the successful message since
if the "tar" command fails, the output may not be what users expect.

Avoid the use of the pipe.  While we are here, refactor the script
removing the use of sub-shell, ${compress}, ${file_ext}.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent dd965f1f
...@@ -24,20 +24,19 @@ tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar" ...@@ -24,20 +24,19 @@ tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
# #
case "${1}" in case "${1}" in
tar-pkg) tar-pkg)
compress="cat" opts=
file_ext=""
;; ;;
targz-pkg) targz-pkg)
compress="gzip" opts=--gzip
file_ext=".gz" tarball=${tarball}.gz
;; ;;
tarbz2-pkg) tarbz2-pkg)
compress="bzip2" opts=--bzip2
file_ext=".bz2" tarball=${tarball}.bz2
;; ;;
tarxz-pkg) tarxz-pkg)
compress="xz" opts=--xz
file_ext=".xz" tarball=${tarball}.xz
;; ;;
*) *)
echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
...@@ -125,14 +124,12 @@ esac ...@@ -125,14 +124,12 @@ esac
# #
# Create the tarball # Create the tarball
# #
( if tar --owner=root --group=root --help >/dev/null 2>&1; then
opts= opts="$opts --owner=root --group=root"
if tar --owner=root --group=root --help >/dev/null 2>&1; then fi
opts="--owner=root --group=root"
fi tar cf $tarball -C $tmpdir $opts $dirs
tar cf - -C "$tmpdir" $dirs $opts | ${compress} > "${tarball}${file_ext}"
)
echo "Tarball successfully created in ${tarball}${file_ext}" echo "Tarball successfully created in $tarball"
exit 0 exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment