40 lines
725 B
Bash
Executable File
40 lines
725 B
Bash
Executable File
#! /bin/sh
|
|
# How to make a distribution tarfile.
|
|
#
|
|
# $1 is the name of the program.
|
|
# $2 is the version number.
|
|
# Remaining args are files to tar.
|
|
|
|
PROGRAM=$1
|
|
VERSION=$2
|
|
|
|
shift; shift
|
|
|
|
if [ "$PROGRAM" = "" -o "$VERSION" = "" ]; then
|
|
echo "Usage: make-tarfile <progname> <version> <file ...>"
|
|
exit 2;
|
|
fi
|
|
|
|
TARFILE=$PROGRAM.tar
|
|
TARDIR=$PROGRAM-$VERSION
|
|
|
|
rm -rf $TARFILE $TARDIR
|
|
mkdir $TARDIR
|
|
(cd $TARDIR; for i in $*; do
|
|
file=`basename $i`
|
|
dir=`echo $i | sed "s/$file\$//" | sed 's@\(.*\)/\$@\1@'`
|
|
if [ "$dir" = "" ]; then dir="."; fi
|
|
if [ "$dir" != "." ]; then
|
|
if [ ! -d "$dir" ]; then mkdir "$dir"; fi
|
|
ln -s ../../$i $i; \
|
|
else
|
|
ln -s ../$i $i
|
|
fi
|
|
done)
|
|
|
|
tar -chf $TARFILE $TARDIR
|
|
rm -rf $TARDIR
|
|
|
|
exit 0
|
|
|