first commit
authorMatteo Nastasi <nastasi@alternativeoutput.it>
Sat, 27 Nov 2010 07:36:12 +0000 (08:36 +0100)
committerMatteo Nastasi <nastasi@alternativeoutput.it>
Sat, 27 Nov 2010 07:36:12 +0000 (08:36 +0100)
INSTALL.sh [new file with mode: 0644]
file_inc.c [new file with mode: 0644]
file_src.c [new file with mode: 0644]
makefile [new file with mode: 0644]
makesimple.sh [new file with mode: 0755]

diff --git a/INSTALL.sh b/INSTALL.sh
new file mode 100644 (file)
index 0000000..9a9c117
--- /dev/null
@@ -0,0 +1,3 @@
+$ su
+# ./makesimple.sh install
+
diff --git a/file_inc.c b/file_inc.c
new file mode 100644 (file)
index 0000000..6821d1c
--- /dev/null
@@ -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 <stdlib.h>
+#include <stdio.h>
+
diff --git a/file_src.c b/file_src.c
new file mode 100644 (file)
index 0000000..c207e26
--- /dev/null
@@ -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 (file)
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 (executable)
index 0000000..5d542b2
--- /dev/null
@@ -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 <e-mail>] <prjname>"
+   exit 1
+fi
+
+# verifica email autore
+if [ "$1" = "-e" ]; then
+   if [ $# -ne 3 ]; then
+      echo "$0 -e <e-mail> <prjname>"
+      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