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