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

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# @P@/make.sh # @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. # COPYING for more information / terms of license.
# #

View File

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

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# @P@/test.sh # @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. # COPYING for more information / terms of license.
# #

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopHeader.h /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopSource.cpp /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/BottomHeader.h /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopHeader.h /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/TopSource.cpp /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -3,7 +3,7 @@
# Metadata file for pkg-config # Metadata file for pkg-config
# ( http://www.freedesktop.org/software/pkgconfig/ ) # ( 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. # COPYING for details.
# #

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/???.cpp /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopHeader.h /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopSource.c /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/clib/BottomHeader.h /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/clib/TopHeader.h /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/clib/TopSource.c /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -3,7 +3,7 @@
# Metadata file for pkg-config # Metadata file for pkg-config
# ( http://www.freedesktop.org/software/pkgconfig/ ) # ( 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. # COPYING for details.
# #

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/???.c /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
# @P@/src/@NAME@/Doxyfile.in # @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. # COPYING for more information / terms of license.
# #

View File

@ -1,6 +1,6 @@
/* @P@/src/@NAME@/MainPage.dox /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopHeader.h /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,6 +1,6 @@
/* @P@/src/capp/TopSource.c /* @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. * COPYING for more information / terms of license.
*/ */

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# @P@/scripts/functions.sh # @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. # COPYING for more information / terms of license.
# #

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# @P@/scripts/module-create.sh # @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. # COPYING for more information / terms of license.
# #

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# @P@/scripts/module-rename.sh # @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. # COPYING for more information / terms of license.
# #

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# @P@/scripts/release.sh # @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. # COPYING for more information / terms of license.
# #