Parameterise author and copyright year.

This commit is contained in:
Laurence Withers 2006-07-24 22:04:40 +01:00
parent 98a21838c8
commit 4667dab403
26 changed files with 39 additions and 60 deletions

View File

@ -13,14 +13,12 @@
# Sanity checks
if [ $# -ne 4 ]
if [ $# -ne 2 ]
then
echo "Wrong number of arguments. Expecting:"
echo " ./install.sh <dest_dir> @P@ @PC@ @HEADER_NAME@"
echo " ./install.sh <dest_dir> @P@ "
echo " dest_dir directory in which project subdir will be created"
echo " @P@ package name (e.g. \"libnmc\")"
echo " @PC@ C identifier version of @P@, used in header etc."
echo " @HEADER_NAME@ name of header (e.g. \"lw-support\" or \"nmc\")"
echo " @P@ package name)"
exit 1
fi
@ -33,11 +31,8 @@ TEMPLATE="$(pwd)/skel"
source ${TEMPLATE}/scripts/functions.sh || exit 1
DEST_DIR="$1"; shift
P="$1"; shift
PC="$1"; shift
HEADER_NAME="$1"; shift
DEST_DIR="${DEST_DIR}/${P}"
PMINUSL="-l$(echo ${P} | sed -e 's,^lib,,')"
@ -46,7 +41,8 @@ PMINUSL="-l$(echo ${P} | sed -e 's,^lib,,')"
# user simply specified where the directory should be created.
echo "Copying ${TEMPLATE} directory..."
do_cmd cp -rp "${TEMPLATE}" "${DEST_DIR}" || exit 1
cd "${DEST_DIR}"
do_cmd cd "${DEST_DIR}" || exit 1
do_cmd mkdir src || exit 1
print_success "Done: $(pwd)"
@ -57,28 +53,16 @@ mv project.kdevelop.filelist ${P}.kdevelop.filelist
# Build sed script
echo "Changing variables..."
echo -n " Building script ( "
SED_SCRIPT="script.sed"
for param in P PC HEADER_NAME PMINUSL
do
echo "s,@${param}@,${!param},g" >> "${SED_SCRIPT}"
echo -n "${PARAM} "
done
echo ")"
# Create a list of all the files.
echo " Building list of files"
ALL_FILES=$(find . -type f -not -name script.sed)
# Run sed script on all files.
echo " Running script"
for f in ${ALL_FILES}
do
do_cmd sed -f "${SED_SCRIPT}" -i "${f}" || exit 1
done
print_success "Done"
# Substitute all relevant variables in files
echo " Substituting variables in files"
AUTHOR="$(grep ^$(whoami): /etc/passwd | cut -d: -f 5)"
YEAR="$(date +%Y)"
do_cmd find . -type f -exec sed \
-e "s,@P@,${P},g" \
-e "s,@AUTHOR@,${AUTHOR},g" \
-e "s,@YEAR@,${YEAR},g"
-i {} \; || exit 1
@ -87,8 +71,3 @@ echo
echo " ======== TODO list ========"
grep -Hn @TODO@ ${ALL_FILES}
print_success "Done"
# Clean up
rm "${SED_SCRIPT}"

View File

@ -1,7 +1,7 @@
#!/bin/bash
# @P@/make.sh
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#

View File

@ -1,7 +1,7 @@
<?xml version = '1.0'?>
<kdevelop>
<general>
<author>Laurence Withers</author>
<author>@AUTHOR@</author>
<email></email>
<version>$VERSION$</version>
<projectmanagement>KDevCustomProject</projectmanagement>

View File

@ -1,7 +1,7 @@
#!/bin/bash
# @P@/test.sh
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopHeader.h
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopSource.cpp
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/BottomHeader.h
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopHeader.h
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopSource.cpp
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -3,7 +3,7 @@
# Metadata file for pkg-config
# ( http://www.freedesktop.org/software/pkgconfig/ )
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for details.
#

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/???.cpp
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopHeader.h
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopSource.c
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/clib/BottomHeader.h
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/clib/TopHeader.h
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/clib/TopSource.c
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -3,7 +3,7 @@
# Metadata file for pkg-config
# ( http://www.freedesktop.org/software/pkgconfig/ )
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for details.
#

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/???.c
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
# @P@/src/@NAME@/Doxyfile.in
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/MainPage.dox
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopHeader.h
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopSource.c
*
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/

View File

@ -1,7 +1,7 @@
#!/bin/bash
# @P@/scripts/functions.sh
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#

View File

@ -1,7 +1,7 @@
#!/bin/bash
# @P@/scripts/module-create.sh
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#

View File

@ -1,7 +1,7 @@
#!/bin/bash
# @P@/scripts/module-rename.sh
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#

View File

@ -1,7 +1,7 @@
#!/bin/bash
# @P@/scripts/release.sh
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#