aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2017-09-18 15:05:08 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2017-09-18 15:05:08 -0700
commit765cd64730ac1d64c93c792b55cb4e58d44d70f0 (patch)
treeeb1d9831d5ac51b8346d42c84a4e95481758d680
parentsnapshots-create: prepare for tar argument cleanup. (diff)
downloadmastermirror-scripts-765cd64730ac1d64c93c792b55cb4e58d44d70f0.tar.gz
mastermirror-scripts-765cd64730ac1d64c93c792b55cb4e58d44d70f0.tar.bz2
mastermirror-scripts-765cd64730ac1d64c93c792b55cb4e58d44d70f0.zip
snapshots-create: improved tar arguments
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xsnapshots-create.sh35
1 files changed, 28 insertions, 7 deletions
diff --git a/snapshots-create.sh b/snapshots-create.sh
index 8f031f0..9b2cbe7 100755
--- a/snapshots-create.sh
+++ b/snapshots-create.sh
@@ -85,18 +85,39 @@ cd ${TEMP}
# create the tarball and move it to the right location
write_time_log "START TARBALL $(date -u)"
if [ ! -f "${FILENAME%.bz2}" ]; then
+ # Build a directory of stuff to tar up.
rm -rf portage
- rsync -Wqa "$MASTER"/ portage/
+ rsync -Wqa \
+ "$MASTER"/ \
+ portage/
if [ $? -ne 0 ]; then
echo "rsync run failed!"
exit 1
fi
- tar \
- --owner=portage \
- --group=portage \
- -cf ${FILENAME%.bz2} \
- portage \
- --exclude .checksum-test-marker
+
+ TAR_OPTIONS=(
+ # GNU tar format saves approximately 1K per file in the tarball over POSIX
+ # format. Multiply ~170k files, and the savings are large.
+ --format=gnu
+ # Sorting by name produces consistent ordering and helps compression of
+ # related content. Custom ordering might further improve ordering in future
+ # (eg all metadata.xml first)
+ --sort=name
+ # Force ownership of content:
+ --owner=portage
+ --group=portage
+ # Excluded content:
+ # This is handled further up, by not rsyncing them at all!
+ # --no-wildcards
+ # --exclude-from "${EXCLUSION_LIST}"
+ # Do not capture any xattr/acl info at all.
+ --no-acls
+ --no-xattrs
+ --no-selinux
+ )
+ tar "${TAR_OPTIONS[@]}" \
+ -cf posix-bf1-${FILENAME%.bz2} \
+ portage
rc=$?
rm -rf portage
if [ $rc -ne 0 ]; then