aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara+fdio@cisco.com>2017-03-31 21:51:20 +0200
committerMauro Sardara <msardara+fdio@cisco.com>2017-03-31 21:51:20 +0200
commiteb0d57ff8bcb3ce39a77b91c4f4672639d8f0ba5 (patch)
treed6d6b29991a6c2a0f1f729baa22d499af9aadfe5
parent7c689091533324860d2de5f29b0855e9b49beea8 (diff)
Add service and configuration file to package installation
Change-Id: Ief7b98cbe68a316ba940233740e620ffd725ef1f Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r--metis/CMakeLists.txt18
-rw-r--r--metis/config/ccnx_metis.conf3
-rw-r--r--metis/config/metis-forwarder.service29
3 files changed, 48 insertions, 2 deletions
diff --git a/metis/CMakeLists.txt b/metis/CMakeLists.txt
index f374af83..f5686d42 100644
--- a/metis/CMakeLists.txt
+++ b/metis/CMakeLists.txt
@@ -12,6 +12,13 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+option(BUILD_WLDR "build with WLDR" ON)
+message("-- Building with WLDR: " ${BUILD_WLDR})
+
+if( BUILD_WLDR )
+ set(WLDR ON CACHE BOOL, "-- Compiling with WLDR")
+endif( BUILD_WLDR )
+
if( UNIX )
link_libraries(m)
endif( UNIX )
@@ -102,7 +109,7 @@ SET(ARCHITECTURE "amd64" CACHE STRING "Architecture")
SET(PACKAGE_MAINTAINER "Mauro Sardara" CACHE STRING "Maintainer")
SET(PACKAGE_VERSION "1.0" CACHE STRING "Version")
SET(BUILD_NUMBER "1" CACHE STRING "Build Number")
-STRING(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME)
+STRING(TOLOWER ${CMAKE_PROJECT_NAME}-forwarder PACKAGE_NAME)
SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
SET(CPACK_PACKAGE_VERSION_MAJOR ${${CMAKE_PROJECT_NAME}_VERSION_MAJOR})
@@ -119,12 +126,19 @@ elseif(RPM_PACKAGE)
SET(TYPE "RPM")
SET(GENERATOR "RPM")
SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${BUILD_NUMBER}.${DISTRIBUTION}.${ARCHITECTURE}")
- SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
+ SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages" "/lib/systemd/system" "/lib" "/lib/systemd")
SET(CPACK_${TYPE}_PACKAGE_REQUIRES "longbow >= 1.0, libevent >= 2.0, openssl >= 1.0, libparc >= 1.0, libccnx-common >= 1.0")
else()
RETURN()
endif()
+# Install also configuration files
+set (METIS_CONFIG ${PROJECT_SOURCE_DIR}/config/ccnx_metis.conf)
+set (METIS_SERVICE ${PROJECT_SOURCE_DIR}/config/metis-forwarder.service)
+
+install(FILES ${METIS_CONFIG} DESTINATION /etc/ccnx)
+install(FILES ${METIS_SERVICE} DESTINATION /lib/systemd/system)
+
SET(CPACK_GENERATOR ${GENERATOR})
SET(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER})
SET(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME})
diff --git a/metis/config/ccnx_metis.conf b/metis/config/ccnx_metis.conf
new file mode 100644
index 00000000..e2de37af
--- /dev/null
+++ b/metis/config/ccnx_metis.conf
@@ -0,0 +1,3 @@
+# Local listeners
+add listener tcp local0 127.0.0.1 9695
+add listener udp local1 127.0.0.1 9695
diff --git a/metis/config/metis-forwarder.service b/metis/config/metis-forwarder.service
new file mode 100644
index 00000000..a1e7123a
--- /dev/null
+++ b/metis/config/metis-forwarder.service
@@ -0,0 +1,29 @@
+# Copyright (c) 2017 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+[Unit]
+Description=Metis is a CCNx socket based forwarder.
+#Documentation=man:metis-forwarder
+
+[Service]
+Environment=PORT=9596
+Environment=LOG_FILE=/tmp/ccnx-metis.log
+Environment=CS_SIZE=1000
+Environment=CONFIG=/etc/ccnx/ccnx_metis.conf
+# This will overrride the default environment
+EnvironmentFile=-/etc/default/metis-forwarder
+ExecStart=/usr/bin/metis_daemon --port ${PORT} --log-file ${LOG_FILE} --capacity ${CS_SIZE} --config ${CONFIG}
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target