glfs/template/newitem
Mark Hymers f45b195302 Initial revision
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@3 af4574ff-66df-0310-9fd7-8a98e5e911e0
2002-07-07 20:28:42 +00:00

38 lines
943 B
Bash

#!/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