diff options
author | Michal Marek <mmarek@suse.cz> | 2009-11-24 10:11:37 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2009-12-12 07:08:15 -0500 |
commit | 91d161857ce9672bd2a8cd99ff712a67186e2e76 (patch) | |
tree | 61818dcc6c8dc6d5b76012996c355e5c29dba325 | |
parent | 8723eaeff59a5146326288392f08be4c894fdad7 (diff) |
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: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | scripts/package/buildtar | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/package/buildtar b/scripts/package/buildtar index b1fd48db1640..51b2aa0acb82 100644 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar | |||
@@ -101,7 +101,11 @@ esac | |||
101 | # | 101 | # |
102 | ( | 102 | ( |
103 | cd "${tmpdir}" | 103 | cd "${tmpdir}" |
104 | tar cf - . | ${compress} > "${tarball}${file_ext}" | 104 | opts= |
105 | if tar --owner=root --group=root --help >/dev/null 2>&1; then | ||
106 | opts="--owner=root --group=root" | ||
107 | fi | ||
108 | tar cf - . $opts | ${compress} > "${tarball}${file_ext}" | ||
105 | ) | 109 | ) |
106 | 110 | ||
107 | echo "Tarball successfully created in ${tarball}${file_ext}" | 111 | echo "Tarball successfully created in ${tarball}${file_ext}" |