3 # (re)generate source tarballs for any directory containing a
4 # .make_tar file. Will *not* include any dot files (e.g. .make_tar)
5 # .make_tar should contain a relative path to the directory that
6 # provides the tarball's base name. For example
7 # $ echo some_dir/src/.make_tar
10 # some_dir/src/some_dir.tar.gz
13 if [ "$1" == '--clean' ]; then
17 TAR_OPTS='--create --gzip --verbose --show-transformed-names --no-wildcards-match-slash --dereference'
19 find . -name '.make_tar' | while read MAKE_TAR_FILE
21 DIR=$(dirname "$MAKE_TAR_FILE")
22 REL_DIR=$(cat "$MAKE_TAR_FILE")
23 TAR_NAME=$(basename $(readlink --canonicalize "$DIR/$REL_DIR"))
24 OUTPUT="$DIR/$TAR_NAME.tar.gz"
25 if [ "$CLEAN" == "1" ]; then
29 tar $TAR_OPTS --file "$OUTPUT" --exclude '.[^A--0-^?]*' --exclude "$TAR_NAME.tar.gz" --directory "$DIR" --transform "s,^./,./$TAR_NAME/," .
32 # Jerry Peek et al.'s "Uniz Power Tools"
33 # 15.5 Matching All "Dot Files" with Wildcards
34 # http://docstore.mik.ua/orelly/unix/upt/ch15_05.htm
35 # for a description of the '.[^A--0-^?]*' expression.