Files
oldlinux-files/bin/old/bash-1.05/make-tarfile
2024-02-19 00:21:52 -05:00

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