glfs/template/newitem

38 lines
943 B
Plaintext
Raw Normal View History

#!/bin/sh
# Copies the template files and replaces template with the supplied package
# name, greatly simplifying the process of adding a new package.
if [ -z "$1" ]
then
echo "Creates template files for a package and fills in the package name."
echo "Usage: $0 <written-package-name> <package-filename>"
echo
echo "Note that if you want to create the package Glib, you should"
echo "call the script as: '$0 Glib glib' so that the filenames are in"
echo "lower case. If you only specify the first option, it is used"
echo "for both the written and filenames."
echo "Note also that *all* filenames in BLFS should be lower-case only"
exit 1
fi
WRITTENNAME=$1
if [ -z "$2" ]
then
FILENAME=$WRITTENNAME
else
FILENAME=$2
fi
pushd `dirname $0`
TEMPLDIR=`pwd`
popd
for i in $TEMPLDIR/template*
do
NEWFILE=`echo $i | sed s@$TEMPLDIR/template@$FILENAME@`
echo $NEWFILE
sed s/template/$WRITTENNAME/g $i > $NEWFILE
done