diff --git a/CMakeLists_template.txt b/CMakeLists_template.txt
index dcccd3019c2fcc6cb9896547c3dadf612187baa8..bd8284c6cda491973a493722e8e3de7188d82570 100755
--- a/CMakeLists_template.txt
+++ b/CMakeLists_template.txt
@@ -77,7 +77,7 @@ IF (UNIX)
   SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")
 
   #Uncomment to add the necessary mantainer scripts
-  #SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/preinst;${CMAKE_SOURCE_DIR}/scripts/debian/postinst;${CMAKE_SOURCE_DIR}/scripts/debian/prerm;${CMAKE_SOURCE_DIR}/scripts/debian/postrm")
+  SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/postinst;${CMAKE_SOURCE_DIR}/scripts/debian/prerm")
 
   #Uncomment to add dependencies comma separated
   #SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-dep1-dev (>= 1.0~${DISTRIB}), iri-dep2-dev (>= 1.0~${DISTRIB})")
@@ -88,4 +88,4 @@ ELSE(UNIX)
     COMMENT "packaging only implemented in unix"
     TARGET  uninstall
   )
-ENDIF(UNIX)
\ No newline at end of file
+ENDIF(UNIX)
diff --git a/new_project.sh b/new_project.sh
index 7f011a08e7a8187c7f066ead4c41b471ae0e2598..e78c24ec9e00751308ffafa47f4f4f7cfea65181 100755
--- a/new_project.sh
+++ b/new_project.sh
@@ -168,6 +168,24 @@ else
   echo "Creating $FILES_DIR directory"
   mkdir $FILES_DIR
 fi  
+#create the scripts directory
+SCRIPTS_DIR="./scripts"
+if [ -e "$SCRIPTS_DIR" ]
+then
+  echo "$SCRIPTS_DIR directory already exists, skipping ..."
+else
+  echo "Creating $SCRIPTS_DIR directory"
+  mkdir $SCRIPTS_DIR
+fi 
+#create the scripts/debian directory
+DEBIAN_DIR="./scripts/debian"
+if [ -e "$DEBIAN_DIR" ]
+then
+  echo "$DEBIAN_DIR directory already exists, skipping ..."
+else
+  echo "Creating $DEBIAN_DIR directory"
+  mkdir $DEBIAN_DIR
+fi
 
 #parse the dependencies and create the dependencies file
 arr=$(echo $DEP | tr "," "\n")
@@ -376,6 +394,9 @@ then
   sed -i "/${comment}/ a ${line_to_add}" ${file}
 fi
 
+sed 's/project_name/'$NAME'/g' <postinst_template >./scripts/debian/postinst
+sed 's/project_name/'$NAME'/g' <prerm_template >./scripts/debian/prerm
+
 if [ $TEST = 1 ]
 then
   Library_name=$(echo $NAME | sed 's/\([a-zA-Z]\)\([a-zA-Z0-9]*\)/\u\1\2/g')
@@ -395,4 +416,6 @@ rm driver_example_src_template.cpp
 rm Findlib_template.cmake
 rm .gitlab-ci_template.yml
 rm new_project.sh
-rm -rf .git
\ No newline at end of file
+rm -rf .git
+rm postinst_template
+rm prerm_template
diff --git a/postinst_template b/postinst_template
new file mode 100755
index 0000000000000000000000000000000000000000..b99aca1fa2d3f09c2c080f75644813618d8f4f26
--- /dev/null
+++ b/postinst_template
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+
+case "$1" in
+  configure)
+    echo "   Trying to add library to ldconfig..."
+    /usr/share/iri/add_lib_to_ld_config.sh -l project_name -p && echo "   Done." || echo "   /usr/share/iri/add_lib_to_ld_config.sh doesn't exists. Download it from iriutils and execute it."
+    
+  ;;
+  abort-upgrade)
+
+  ;;
+  abort-remove)
+
+  ;;
+  abort-deconfigure)
+
+  ;;
+esac   
+
+exit 0
diff --git a/prerm_template b/prerm_template
new file mode 100644
index 0000000000000000000000000000000000000000..3238e5e5abda4ae00553d85cd36138b17299acbd
--- /dev/null
+++ b/prerm_template
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -e
+
+case "$1" in
+  remove)
+    echo "   Trying to remove library from ldconfig..."
+    /usr/share/iri/remove_lib_from_ld_config.sh -l project_name -p && echo "   Done." || echo "   /usr/share/iri/remove_lib_from_ld_config.sh doesn't exists. Download it from iriutils and execute it."
+
+  ;;
+  upgrade)
+
+  ;;
+  deconfigure)
+
+  ;;
+  failed-upgrade)
+
+  ;;
+esac    
+
+exit 0