aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/package
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-02 04:05:35 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-12 11:20:33 -0400
commit77780f799e66cd261746a281dbbef1ee0c6997cd (patch)
tree42f875c405dffcf2970fdd80e9d540d1def65d65 /scripts/package
parentdd965f1f0857e72eb6d4cfb28769ba01465ba01b (diff)
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: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/package')
-rwxr-xr-xscripts/package/buildtar29
1 files changed, 13 insertions, 16 deletions
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index 60dd836a0214..51f947118256 100755
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -24,20 +24,19 @@ tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
24# 24#
25case "${1}" in 25case "${1}" in
26 tar-pkg) 26 tar-pkg)
27 compress="cat" 27 opts=
28 file_ext=""
29 ;; 28 ;;
30 targz-pkg) 29 targz-pkg)
31 compress="gzip" 30 opts=--gzip
32 file_ext=".gz" 31 tarball=${tarball}.gz
33 ;; 32 ;;
34 tarbz2-pkg) 33 tarbz2-pkg)
35 compress="bzip2" 34 opts=--bzip2
36 file_ext=".bz2" 35 tarball=${tarball}.bz2
37 ;; 36 ;;
38 tarxz-pkg) 37 tarxz-pkg)
39 compress="xz" 38 opts=--xz
40 file_ext=".xz" 39 tarball=${tarball}.xz
41 ;; 40 ;;
42 *) 41 *)
43 echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 42 echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
@@ -125,14 +124,12 @@ esac
125# 124#
126# Create the tarball 125# Create the tarball
127# 126#
128( 127if tar --owner=root --group=root --help >/dev/null 2>&1; then
129 opts= 128 opts="$opts --owner=root --group=root"
130 if tar --owner=root --group=root --help >/dev/null 2>&1; then 129fi
131 opts="--owner=root --group=root" 130
132 fi 131tar cf $tarball -C $tmpdir $opts $dirs
133 tar cf - -C "$tmpdir" $dirs $opts | ${compress} > "${tarball}${file_ext}"
134)
135 132
136echo "Tarball successfully created in ${tarball}${file_ext}" 133echo "Tarball successfully created in $tarball"
137 134
138exit 0 135exit 0