update credits
[LibreOffice.git] / external / boost / repack_tarball.sh
blobed27875f6defbbcc972fbfdf329cd5c9a037a418
1 #! /bin/sh
3 # Repack the boost tarball as xz (much faster to unpack) and remove
4 # a lot of needless files such as generated html docs.
6 tarball="$1"
8 if test -z "$tarball" -o ! -f "$tarball"; then
9 echo "Usage: $0 <tarball>"
10 exit 1
13 tmpdir=$(mktemp -d)
15 if ! test -d "$tmpdir"; then
16 echo mktemp failed
17 exit 1
20 echo Unpacking "$tarball" ...
21 tar x -C "$tmpdir" -f "$tarball"
22 if test $? -ne 0; then
23 echo tar x failed
24 rm -rf "$tmpdir"
25 exit 1
28 echo Removing unnecessary files ...
29 find "$tmpdir" \( -name doc -o -name test -o -name example \) -type d -prune -print0 | xargs -0 rm -r
30 if test $? -ne 0; then
31 echo file removal failed
32 rm -rf "$tmpdir"
33 exit 1
36 name="$(basename "$tarball" | sed 's/\.tar.*$//').tar.xz"
37 dir=$(ls "$tmpdir")
39 echo Creating "$name" ...
40 # To make the tarball reproducible, use a timestamp of a file inside the tarball (they all seem to have the same mtime).
41 if ! test -f "$tmpdir/$dir/README.md"; then
42 echo timestamp retrieval failed, check the script
43 rm -rf "$tmpdir"
44 exit 1
46 # Many of the options are to make the tarball reproducible.
47 LC_ALL=C tar c -C "$tmpdir" --xz -f "$(pwd)/$name" --format=gnu --sort=name --owner=0 --group=0 --mode=go=rX,u=rwX --mtime "$tmpdir/$dir/README.md" "$dir"
48 if test $? -ne 0; then
49 echo tar c failed
50 rm -rf "$tmpdir"
51 exit 1
54 echo Cleaning up ...
55 rm -rf "$tmpdir"
57 sha256sum "$name"
59 echo Done.
60 exit 0