initial
[prop.git] / bin / Distribute
blobfa52fcd6a7befe09bc356cb29bf888cd54d3be48
1 #!/bin/sh
3 # This script creates a distribution tape of the current directory
4 # excluding all the files listed in NO_DISTRIBUTE.
6 export PATH
8 NO_DISTRIBUTE=$1
10 if [ x$NO_DISTRIBUTE = x ]; then
11 echo "Missing the distribution file"
12 exit 1
15 PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin
16 DIR=`pwd`
17 PROPDIR=`basename $DIR`
18 echo "Creating distribution for $PROPDIR"
19 rm -f MANIFEST TIMESTAMP
20 echo "Distribution made on `date` by `whoami`" >TIMESTAMP
21 uname -a >>TIMESTAMP
23 if [ -f $NO_DISTRIBUTE ]; then
24 PAT=`grep -v '^#' $NO_DISTRIBUTE`
25 PAT="^(@@@|"`echo "$PAT" | tr '\012' '|'`"@@@)\$"
26 cd ..
27 echo "'$PAT'"
28 find $PROPDIR ! -type d -print | egrep -v "$PAT" | sort > $PROPDIR/MANIFEST
29 else
30 cd ..
31 find $PROPDIR ! -type d -print | sort > $PROPDIR/MANIFEST
33 echo "Distributing list MANIFEST created"
35 tar -cvf $PROPDIR.tar $PROPDIR/MANIFEST
37 COUNT=""
38 SMALL_LIST=""
39 MARKER=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
40 FILES=`cat $PROPDIR/MANIFEST`
41 for file in $FILES ; do
42 COUNT=X$COUNT
43 SMALL_LIST="$SMALL_LIST $file"
44 if [ $COUNT = $MARKER ]; then
45 tar -rvf $PROPDIR.tar $SMALL_LIST;
46 COUNT="";
47 SMALL_LIST="";
48 fi;
49 done
50 tar -rvf $PROPDIR.tar $SMALL_LIST $PROPDIR/MANIFEST
52 if [ -f $PROPDIR.tar.gz ]; then
53 echo "Moving $PROPDIR.tar.gz to $PROPDIR.tar.gz.bak"
54 mv $PROPDIR.tar.gz $PROPDIR.tar.gz.bak
56 echo "gzip $PROPDIR.tar"
57 gzip $PROPDIR.tar
58 echo "Distribution file is in ../$PROPDIR.tar.gz"