| 1 |
#!/bin/ksh |
| 2 |
# |
| 3 |
# GenericDistrib -- generic lsof 4.x distribution gzip'd archive builder |
| 4 |
# GenericDistrib2 -- generic lsof 4.x distribution bzip2'd archive builder |
| 5 |
# |
| 6 |
# Usage: GenericDistrib <dialect> [<suffix>] |
| 7 |
# |
| 8 |
# <dialect> dialect's subdirectory name |
| 9 |
# |
| 10 |
# [<suffix>] optional suffix for version number |
| 11 |
|
| 12 |
cd $(dirname $0)/.. |
| 13 |
|
| 14 |
# Get version number. |
| 15 |
|
| 16 |
V=`sed '/VN/s/.ds VN \(.*\)/\1/' version` |
| 17 |
if test $? -ne 0 |
| 18 |
then |
| 19 |
echo $V |
| 20 |
exit 1 |
| 21 |
fi |
| 22 |
|
| 23 |
# Handle arguments. |
| 24 |
|
| 25 |
if test $# -lt 1 -o $# -gt 2 |
| 26 |
then |
| 27 |
echo "Usage: <dialect> [<suffix>]" |
| 28 |
exit 1 |
| 29 |
fi |
| 30 |
DIALECT=$1 |
| 31 |
if test $# -eq 2 |
| 32 |
then |
| 33 |
V=${V}$2 |
| 34 |
fi |
| 35 |
|
| 36 |
# Set variable names. |
| 37 |
|
| 38 |
DIR=lsof_${V}.${DIALECT} |
| 39 |
TAR=${DIR}.tar |
| 40 |
echo $0 | grep 2 > /dev/null |
| 41 |
if test $? -eq 0 |
| 42 |
then |
| 43 |
TARC=${TAR}.bz2 |
| 44 |
COMP=bzip2 |
| 45 |
else |
| 46 |
TARC=${TAR}.gz |
| 47 |
COMP=gzip |
| 48 |
fi |
| 49 |
|
| 50 |
# Prepare for premature exit. |
| 51 |
|
| 52 |
trap 'rm -rf $DIR $TAR $TARC; exit' 1 2 3 15 |
| 53 |
|
| 54 |
# Make a temporary directory with the relevant files in it and |
| 55 |
# create a gzip'd tar archive of it. |
| 56 |
|
| 57 |
rm -rf $TAR $TARC |
| 58 |
./support/GenericSubdir $1 $2 |
| 59 |
echo "Making $TAR ...\c" |
| 60 |
tar cf $TAR $DIR |
| 61 |
echo " done" |
| 62 |
ls -l $TAR |
| 63 |
echo "Removing $DIR ...\c" |
| 64 |
rm -rf $DIR |
| 65 |
echo " done" |
| 66 |
echo "$COMP $TAR ...\c" |
| 67 |
$COMP -c $TAR > support/$TARC |
| 68 |
echo " done" |
| 69 |
ls -l support/$TARC |
| 70 |
rm -f $TAR |