tar notes
From Noah.org
Revision as of 12:31, 4 August 2010 by Root (talk | contribs) (Created page with 'Category:Engineering == permission and ownership of files inside a tar == If you are making tarballs for installing on other machines you usually want the files inside the …')
permission and ownership of files inside a tar
If you are making tarballs for installing on other machines you usually want the files inside the archive to be owned by root. Usually you do not build as root. You can force ownership and group with three arguments. This will record the UID and GID in the tar file as 0 (root).
tar --numeric-owner --owner=0 --group=0 -czf install_tree.tgz $STAGING_DIR
This is a fancier version that sets input and directories; trims the trailing slash off of STAGING_DIR; and sets the gzip compression level to the max.
GZIP="--best" tar --numeric-owner --owner=0 --group=0 --directory=${STAGING_DIR%/*} --exclude=.svn -czf ${OUTPUT_DIR##*/}/piebox_setup.tar.gz ${STAGING_DIR##*/}