History

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.

Michal Marek committed 16 years ago

Commit 91d16181 parent 8723eae1 file · +5 −1Browse files

Unified · Split

scripts/package/buildtar+5−1
@@ -101,7 +101,11 @@ esac · 100 unmodified lines
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
107echo "Tarball successfully created in ${tarball}${file_ext}"111echo "Tarball successfully created in ${tarball}${file_ext}"