提交 91d16185 编写于 作者: M Michal Marek

scripts/package: tar-pkg: use tar --owner=root

Use the --owner= and --group= options to make sure the entries in
the built tar file are owned by root.  Without this change, a
careless sysadmin using the tar-pkg target can easily end up
installing a kernel that is writable by the unprivileged user
account used to build the kernel.

Test that these options are understood before using them so that
non-GNU versions of tar can still be used if the operator is
appropriately cautious.
Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
Signed-off-by: NMichal Marek <mmarek@suse.cz>
上级 8723eaef
...@@ -101,7 +101,11 @@ esac ...@@ -101,7 +101,11 @@ esac
# #
( (
cd "${tmpdir}" cd "${tmpdir}"
tar cf - . | ${compress} > "${tarball}${file_ext}" opts=
if tar --owner=root --group=root --help >/dev/null 2>&1; then
opts="--owner=root --group=root"
fi
tar cf - . $opts | ${compress} > "${tarball}${file_ext}"
) )
echo "Tarball successfully created in ${tarball}${file_ext}" echo "Tarball successfully created in ${tarball}${file_ext}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册