From 6ae6f324498218b4e69547006c16ae110603ca5d Mon Sep 17 00:00:00 2001
From: Alopez <alopez@iri.upc.edu>
Date: Tue, 3 Nov 2020 16:58:30 +0100
Subject: [PATCH] Adapted to Ubuntu 18.04 package generation

---
 CMakeLists.txt          |  2 +-
 scripts/debian/postinst | 22 ++++++++++++++++++++++
 scripts/debian/prerm    | 22 ++++++++++++++++++++++
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100755 scripts/debian/postinst
 create mode 100644 scripts/debian/prerm

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 717e502..34dc0e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,7 +83,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}/package_scripts/preinst;${CMAKE_SOURCE_DIR}/package_scripts/postinst;${CMAKE_SOURCE_DIR}/package_scripts/prerm;${CMAKE_SOURCE_DIR}/package_scripts/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-<package_name>-dev (>= 1.0~${DISTRIB})")
diff --git a/scripts/debian/postinst b/scripts/debian/postinst
new file mode 100755
index 0000000..bd0c360
--- /dev/null
+++ b/scripts/debian/postinst
@@ -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 lidar_lite -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/scripts/debian/prerm b/scripts/debian/prerm
new file mode 100644
index 0000000..8eb872f
--- /dev/null
+++ b/scripts/debian/prerm
@@ -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 lidar_lite -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
-- 
GitLab