From 2baabdd524881d952ad010628ca83d652e10ab8a Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sat, 27 Nov 2010 08:36:12 +0100 Subject: [PATCH] first commit --- INSTALL.sh | 3 +++ file_inc.c | 24 +++++++++++++++++++++ file_src.c | 29 +++++++++++++++++++++++++ makefile | 17 +++++++++++++++ makesimple.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+) create mode 100644 INSTALL.sh create mode 100644 file_inc.c create mode 100644 file_src.c create mode 100644 makefile create mode 100755 makesimple.sh diff --git a/INSTALL.sh b/INSTALL.sh new file mode 100644 index 0000000..9a9c117 --- /dev/null +++ b/INSTALL.sh @@ -0,0 +1,3 @@ +$ su +# ./makesimple.sh install + diff --git a/file_inc.c b/file_inc.c new file mode 100644 index 0000000..6821d1c --- /dev/null +++ b/file_inc.c @@ -0,0 +1,24 @@ +/* + * #PRJNAME#.h + * + * Copyright (C) #COPYDATE# #COPYAUTH# + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. You should have received a + * copy of the GNU General Public License along with this program; if + * not, write to the Free Software Foundation, Inc, 59 Temple Place - + * Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +#include +#include + diff --git a/file_src.c b/file_src.c new file mode 100644 index 0000000..c207e26 --- /dev/null +++ b/file_src.c @@ -0,0 +1,29 @@ +/* + * #PRJNAME#.c + * + * Copyright (C) #COPYDATE# #COPYAUTH# + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. You should have received a + * copy of the GNU General Public License along with this program; if + * not, write to the Free Software Foundation, Inc, 59 Temple Place - + * Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "#PRJNAME#.h" + +int main(int argc, char *argv[]) +{ + + + exit (0); + return (0); +} diff --git a/makefile b/makefile new file mode 100644 index 0000000..5fe3e27 --- /dev/null +++ b/makefile @@ -0,0 +1,17 @@ +# +# Project #PRJNAME# +# +EXE=#PRJNAME# +OBJ=#PRJNAME#.o + +CC?=gcc + +ALL: #PRJNAME# + +#PRJNAME#: #PRJNAME#.c #PRJNAME#.h + $(CC) -o #PRJNAME# #PRJNAME#.c + +clean: + rm -f $(EXE) $(OBJ) *~ + +.PHONY: clean ALL diff --git a/makesimple.sh b/makesimple.sh new file mode 100755 index 0000000..5d542b2 --- /dev/null +++ b/makesimple.sh @@ -0,0 +1,60 @@ +#!/bin/bash +#set -x +function sedder() { + sed "s/#PRJNAME#/$prjname/g" |\ + sed "s/#COPYDATE#/$copydate/g" |\ + sed "s/#COPYAUTH#/$copyauth/g" +} + + +id=`whoami` +if [ $# -lt 1 ]; then + echo "$0 [-e ] " + exit 1 +fi + +# verifica email autore +if [ "$1" = "-e" ]; then + if [ $# -ne 3 ]; then + echo "$0 -e " + exit 1 + fi + emailauth="$2" + shift 2 +fi +prjname="$1" + +if [ "$id" != "root" -a "$prjname" = "install" ]; then + echo "you must be root user to install this package" + exit 1 +fi +TMPLPATH=/var/lib/makesimple +SRCFILE=$TMPLPATH/file_src.c +HFILE=$TMPLPATH/file_inc.h +MAKFILE=$TMPLPATH/makefile + +copydate="`date +%Y`" +copyauth="$emailauth" +if [ "$prjname" = "install" ]; then + echo "Install" + ls * + echo "Continue (y/n)" + read a + if [ "$a" = "y" -o "$a" = "Y" ]; then + if [ ! -x "$TMPLPATH" ]; then + mkdir "$TMPLPATH" || exit 5 + fi + rm -f "$TMPLPATH"/* || exit 6 + cp * "$TMPLPATH" || exit 7 + cp ./makesimple.sh /usr/local/bin || exit 8 + echo "Installation OK" + fi + exit 0 +fi +mkdir "$prjname" || exit 2 +cd "$prjname" || exit 3 +sedder < $SRCFILE > ./${prjname}.c +sedder < $HFILE > ./${prjname}.h +sedder < $MAKFILE > ./makefile + +exit 0 -- 2.17.1