aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-10-24 20:59:30 +0200
committerMauro Sardara <msardara@cisco.com>2019-10-25 11:59:49 +0200
commitbaaeb1af53ab4c64b31786bddfd7573445f21342 (patch)
tree5934885d9732b8c890d8ee89787ba5d3f2dbd527
parentcf3d6ef0cbda50c9917421213a77097250f3d67b (diff)
[HICN-358] Enable systemctl service after package installation.
Change-Id: I1c9a7099fbf59c09fb22475e9695373f316d0b6e Signed-off-by: Mauro Sardara <msardara@cisco.com>
-rw-r--r--cmake/Modules/Packager.cmake6
-rw-r--r--hicn-light/cmake/Modules/Packaging.cmake17
-rw-r--r--hicn-light/config/hicn-light.service4
-rwxr-xr-xhicn-light/config/post3
-rwxr-xr-xhicn-light/config/postinst3
-rwxr-xr-xhicn-light/config/prerm3
-rwxr-xr-xhicn-light/config/preun3
7 files changed, 35 insertions, 4 deletions
diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake
index 6f77fd3a8..e5e3fa731 100644
--- a/cmake/Modules/Packager.cmake
+++ b/cmake/Modules/Packager.cmake
@@ -136,7 +136,7 @@ macro(make_packages)
set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
set(CPACK_COMPONENT_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
- if (NOT ${${lc}_DEB_PACKAGE_CONTROL_EXTRA} STREQUAL "")
+ if (${lc}_DEB_PACKAGE_CONTROL_EXTRA)
set(CPACK_DEBIAN_${uc}_PACKAGE_CONTROL_EXTRA "${${lc}_DEB_PACKAGE_CONTROL_EXTRA}")
endif()
endforeach()
@@ -183,6 +183,10 @@ macro(make_packages)
if (NOT ${${lc}_RPM_POST_UNINSTALL_SCRIPT_FILE} STREQUAL "")
set(CPACK_RPM_${uc}_POST_UNINSTALL_SCRIPT_FILE "${${lc}_RPM_POST_UNINSTALL_SCRIPT_FILE}")
endif()
+
+ if (NOT ${${lc}_RPM_PRE_UNINSTALL_SCRIPT_FILE} STREQUAL "")
+ set(CPACK_RPM_${uc}_PRE_UNINSTALL_SCRIPT_FILE "${${lc}_RPM_PRE_UNINSTALL_SCRIPT_FILE}")
+ endif()
endforeach()
endif()
diff --git a/hicn-light/cmake/Modules/Packaging.cmake b/hicn-light/cmake/Modules/Packaging.cmake
index 006261b03..2b9f4a7b9 100644
--- a/hicn-light/cmake/Modules/Packaging.cmake
+++ b/hicn-light/cmake/Modules/Packaging.cmake
@@ -25,7 +25,22 @@ set(${HICN_LIGHT}_DEB_DEPENDENCIES
CACHE STRING "Dependencies for deb/rpm package."
)
+set(${HICN_LIGHT}_DEB_PACKAGE_CONTROL_EXTRA
+ "${CMAKE_CURRENT_SOURCE_DIR}/config/postinst;${CMAKE_CURRENT_SOURCE_DIR}/config/prerm"
+ CACHE STRING "Control scripts conffiles, postinst, postrm, prerm."
+)
+
set(${HICN_LIGHT}_RPM_DEPENDENCIES
"lib${LIBHICN} >= stable_version, libparc >= 1.0"
CACHE STRING "Dependencies for deb/rpm package."
-) \ No newline at end of file
+)
+
+set(${HICN_LIGHT}_RPM_POST_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_SOURCE_DIR}/config/post"
+ CACHE STRING "Install script that will be copied in the %post section"
+)
+
+set(${HICN_LIGHT}_RPM_PRE_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_SOURCE_DIR}/config/preun"
+ CACHE STRING "Install script that will be copied in the %post section"
+)
diff --git a/hicn-light/config/hicn-light.service b/hicn-light/config/hicn-light.service
index 0f976fc6c..f269b2f26 100644
--- a/hicn-light/config/hicn-light.service
+++ b/hicn-light/config/hicn-light.service
@@ -21,8 +21,8 @@ Environment=LOG_FILE=/tmp/hicn_light.log
Environment=CS_SIZE=1000
Environment=CONFIG=/etc/hicn/hicn_light.conf
# This will overrride the default environment
-EnvironmentFile=-/etc/default/source
-ExecStart=/usr/bin/hicnLightDaemon --port ${PORT} --log-file ${LOG_FILE} --capacity ${CS_SIZE} --config ${CONFIG}
+EnvironmentFile=-/etc/default/hicn-light
+ExecStart=/usr/bin/hicn-light-daemon --port ${PORT} --log-file ${LOG_FILE} --capacity ${CS_SIZE} --config ${CONFIG}
Restart=on-failure
[Install]
diff --git a/hicn-light/config/post b/hicn-light/config/post
new file mode 100755
index 000000000..dced2a093
--- /dev/null
+++ b/hicn-light/config/post
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+systemctl enable hicn-light \ No newline at end of file
diff --git a/hicn-light/config/postinst b/hicn-light/config/postinst
new file mode 100755
index 000000000..dced2a093
--- /dev/null
+++ b/hicn-light/config/postinst
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+systemctl enable hicn-light \ No newline at end of file
diff --git a/hicn-light/config/prerm b/hicn-light/config/prerm
new file mode 100755
index 000000000..4584c7057
--- /dev/null
+++ b/hicn-light/config/prerm
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+systemctl disable hicn-light \ No newline at end of file
diff --git a/hicn-light/config/preun b/hicn-light/config/preun
new file mode 100755
index 000000000..4584c7057
--- /dev/null
+++ b/hicn-light/config/preun
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+systemctl disable hicn-light \ No newline at end of file