diff --git a/install.sh b/install.sh index 734eccf..c1a6790 100755 --- a/install.sh +++ b/install.sh @@ -13,14 +13,12 @@ # Sanity checks -if [ $# -ne 4 ] +if [ $# -ne 2 ] then echo "Wrong number of arguments. Expecting:" - echo " ./install.sh @P@ @PC@ @HEADER_NAME@" + echo " ./install.sh @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}" diff --git a/skel/make.sh b/skel/make.sh index 8b2f96b..5b6eb9c 100755 --- a/skel/make.sh +++ b/skel/make.sh @@ -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. # diff --git a/skel/project.kdevelop b/skel/project.kdevelop index 4f4c3c0..d8b6c63 100644 --- a/skel/project.kdevelop +++ b/skel/project.kdevelop @@ -1,7 +1,7 @@ - Laurence Withers + @AUTHOR@ $VERSION$ KDevCustomProject diff --git a/skel/run-test.sh b/skel/run-test.sh index 332352d..7206442 100755 --- a/skel/run-test.sh +++ b/skel/run-test.sh @@ -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. # diff --git a/skel/scripts/build.c++.app/TopHeader.h b/skel/scripts/build.c++.app/TopHeader.h index 86e56c5..f6410ad 100644 --- a/skel/scripts/build.c++.app/TopHeader.h +++ b/skel/scripts/build.c++.app/TopHeader.h @@ -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. */ diff --git a/skel/scripts/build.c++.app/TopSource.cpp b/skel/scripts/build.c++.app/TopSource.cpp index 5744070..3a2652e 100644 --- a/skel/scripts/build.c++.app/TopSource.cpp +++ b/skel/scripts/build.c++.app/TopSource.cpp @@ -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. */ diff --git a/skel/scripts/build.c++.lib/BottomHeader.h b/skel/scripts/build.c++.lib/BottomHeader.h index 2db887a..bb10780 100644 --- a/skel/scripts/build.c++.lib/BottomHeader.h +++ b/skel/scripts/build.c++.lib/BottomHeader.h @@ -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. */ diff --git a/skel/scripts/build.c++.lib/TopHeader.h b/skel/scripts/build.c++.lib/TopHeader.h index 96831b8..0ee1656 100644 --- a/skel/scripts/build.c++.lib/TopHeader.h +++ b/skel/scripts/build.c++.lib/TopHeader.h @@ -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. */ diff --git a/skel/scripts/build.c++.lib/TopSource.cpp b/skel/scripts/build.c++.lib/TopSource.cpp index e6bfd84..e28105f 100644 --- a/skel/scripts/build.c++.lib/TopSource.cpp +++ b/skel/scripts/build.c++.lib/TopSource.cpp @@ -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. */ diff --git a/skel/scripts/build.c++.lib/pkgconf.in b/skel/scripts/build.c++.lib/pkgconf.in index d9cc01d..e4c4ce2 100644 --- a/skel/scripts/build.c++.lib/pkgconf.in +++ b/skel/scripts/build.c++.lib/pkgconf.in @@ -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. # diff --git a/skel/scripts/build.c++.tests/template b/skel/scripts/build.c++.tests/template index 341801d..10c781d 100644 --- a/skel/scripts/build.c++.tests/template +++ b/skel/scripts/build.c++.tests/template @@ -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. */ diff --git a/skel/scripts/build.c.app/TopHeader.h b/skel/scripts/build.c.app/TopHeader.h index b8b8ac6..de38373 100644 --- a/skel/scripts/build.c.app/TopHeader.h +++ b/skel/scripts/build.c.app/TopHeader.h @@ -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. */ diff --git a/skel/scripts/build.c.app/TopSource.c b/skel/scripts/build.c.app/TopSource.c index 4b1e45e..bbdd989 100644 --- a/skel/scripts/build.c.app/TopSource.c +++ b/skel/scripts/build.c.app/TopSource.c @@ -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. */ diff --git a/skel/scripts/build.c.lib/BottomHeader.h b/skel/scripts/build.c.lib/BottomHeader.h index 702d660..7873917 100644 --- a/skel/scripts/build.c.lib/BottomHeader.h +++ b/skel/scripts/build.c.lib/BottomHeader.h @@ -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. */ diff --git a/skel/scripts/build.c.lib/TopHeader.h b/skel/scripts/build.c.lib/TopHeader.h index b0591f2..3be1712 100644 --- a/skel/scripts/build.c.lib/TopHeader.h +++ b/skel/scripts/build.c.lib/TopHeader.h @@ -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. */ diff --git a/skel/scripts/build.c.lib/TopSource.c b/skel/scripts/build.c.lib/TopSource.c index 0213c1f..eba9f82 100644 --- a/skel/scripts/build.c.lib/TopSource.c +++ b/skel/scripts/build.c.lib/TopSource.c @@ -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. */ diff --git a/skel/scripts/build.c.lib/pkgconf.in b/skel/scripts/build.c.lib/pkgconf.in index 1c3ab6a..f49b93a 100644 --- a/skel/scripts/build.c.lib/pkgconf.in +++ b/skel/scripts/build.c.lib/pkgconf.in @@ -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. # diff --git a/skel/scripts/build.c.tests/template b/skel/scripts/build.c.tests/template index b61b123..016563c 100644 --- a/skel/scripts/build.c.tests/template +++ b/skel/scripts/build.c.tests/template @@ -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. */ diff --git a/skel/scripts/build.doxygen.docs/Doxyfile.in b/skel/scripts/build.doxygen.docs/Doxyfile.in index 2f2909c..a2c2c0c 100644 --- a/skel/scripts/build.doxygen.docs/Doxyfile.in +++ b/skel/scripts/build.doxygen.docs/Doxyfile.in @@ -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. # diff --git a/skel/scripts/build.doxygen.docs/MainPage.dox b/skel/scripts/build.doxygen.docs/MainPage.dox index bf28f05..1549a1a 100644 --- a/skel/scripts/build.doxygen.docs/MainPage.dox +++ b/skel/scripts/build.doxygen.docs/MainPage.dox @@ -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. */ diff --git a/skel/scripts/build.sdcc.app/TopHeader.h b/skel/scripts/build.sdcc.app/TopHeader.h index b8b8ac6..de38373 100644 --- a/skel/scripts/build.sdcc.app/TopHeader.h +++ b/skel/scripts/build.sdcc.app/TopHeader.h @@ -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. */ diff --git a/skel/scripts/build.sdcc.app/TopSource.c b/skel/scripts/build.sdcc.app/TopSource.c index 4b1e45e..bbdd989 100644 --- a/skel/scripts/build.sdcc.app/TopSource.c +++ b/skel/scripts/build.sdcc.app/TopSource.c @@ -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. */ diff --git a/skel/scripts/functions.sh b/skel/scripts/functions.sh index 303f44b..12b63a0 100755 --- a/skel/scripts/functions.sh +++ b/skel/scripts/functions.sh @@ -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. # diff --git a/skel/scripts/module-create.sh b/skel/scripts/module-create.sh index 316a762..e138500 100755 --- a/skel/scripts/module-create.sh +++ b/skel/scripts/module-create.sh @@ -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. # diff --git a/skel/scripts/module-rename.sh b/skel/scripts/module-rename.sh index 340d3a3..63f68c6 100755 --- a/skel/scripts/module-rename.sh +++ b/skel/scripts/module-rename.sh @@ -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. # diff --git a/skel/scripts/release.sh b/skel/scripts/release.sh index 653c994..8e45269 100755 --- a/skel/scripts/release.sh +++ b/skel/scripts/release.sh @@ -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. #