diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-06-06 14:21:51 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-06-06 16:31:16 +0200 |
commit | e02a10dac7d80b3ee025a3a605d1016006e539f6 (patch) | |
tree | ad3b29792803fc50ab1c95bd65123909e267c460 | |
parent | e58b5b6aaac9f4ed94fc30678fe36090523f3915 (diff) |
Adding service files for running http-server as a systemd service
Change-Id: If033d8c1526a118bc902c4fc3717b05d0b422a5d
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r-- | CMakeLists.txt | 18 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | config/hicn-http-server.service | 29 | ||||
-rw-r--r-- | config/http-server.service | 29 |
4 files changed, 71 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f909c9c1..14e7db16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,11 +27,13 @@ option(HICNET "Link against Libhicnet." OFF) if (HICNET) find_package(Libhicnet REQUIRED) - set (TRANSPORT_LIBRARY HICNET) + set(TRANSPORT_LIBRARY HICNET) set(ICNET OFF) + set(PREFIX "hicn-") else() find_package(Libicnet REQUIRED) - set (TRANSPORT_LIBRARY ICNET) + set(TRANSPORT_LIBRARY ICNET) + set(PREFIX "") endif() configure_file("${PROJECT_SOURCE_DIR}/config.h.in" @@ -77,10 +79,10 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS} -fper set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS} -fpermissive") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS} -fpermissive") -add_executable(http-server ${SOURCE_FILES}) -target_link_libraries(http-server ${LIB${TRANSPORT_LIBRARY}_LIBRARY} ${CURL_LIBRARY} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +add_executable(${PREFIX}http-server ${SOURCE_FILES}) +target_link_libraries(${PREFIX}http-server ${LIB${TRANSPORT_LIBRARY}_LIBRARY} ${CURL_LIBRARY} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) -install(TARGETS http-server DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS ${PREFIX}http-server DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) # Generate DEB / RPM packages @@ -93,7 +95,7 @@ set(DISTRIBUTION "xenial" CACHE STRING "Distribution") set(ARCHITECTURE "amd64" CACHE STRING "Architecture") set(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer") set(BUILD_NUMBER "1" CACHE STRING "Build Number") -string(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME) +string(TOLOWER ${PREFIX}${CMAKE_PROJECT_NAME} PACKAGE_NAME) set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") set(CPACK_PACKAGE_VENDOR ${VENDOR}) @@ -123,6 +125,10 @@ else () return() endif () +# Install also configuration files +set (HTTP_SERVER_SERVICE ${PROJECT_SOURCE_DIR}/config/${PREFIX}http-server.service) +install(FILES ${HTTP_SERVER_SERVICE} DESTINATION /lib/systemd/system RENAME ${PREFIX}http-server.service) + set(CPACK_GENERATOR ${GENERATOR}) set(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER}) set(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME}) @@ -122,4 +122,4 @@ Http-server has been tested in: - Ubuntu 14.04 (x86_64) - Debian Testing - MacOSX 10.12 - - CentOS 7 + - CentOS 7
\ No newline at end of file diff --git a/config/hicn-http-server.service b/config/hicn-http-server.service new file mode 100644 index 00000000..20b73c38 --- /dev/null +++ b/config/hicn-http-server.service @@ -0,0 +1,29 @@ +# Copyright (c) 2015, Cisco Systems +# +# This file is part of the NDN connectivity-manager. +# See AUTHORS.md for complete list of authors and contributors. +# +# 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 3 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 MERCHANTABILITY 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, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. +# +# Author: Mauro Sardara <mauro.sardara@cisco.com> + +[Unit] +Description=Http Server using tcp/icn as tranport protocol +#Documentation=man:http-server +Requires=hicn-forwarder.service + +[Service] +ExecStart=/usr/bin/hicn-http-server +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/config/http-server.service b/config/http-server.service new file mode 100644 index 00000000..75a4f7b0 --- /dev/null +++ b/config/http-server.service @@ -0,0 +1,29 @@ +# Copyright (c) 2015, Cisco Systems +# +# This file is part of the NDN connectivity-manager. +# See AUTHORS.md for complete list of authors and contributors. +# +# 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 3 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 MERCHANTABILITY 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, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. +# +# Author: Mauro Sardara <mauro.sardara@cisco.com> + +[Unit] +Description=Http Server using tcp/icn as tranport protocol +#Documentation=man:http-server +Requires=metis-forwarder.service + +[Service] +ExecStart=/usr/bin/http-server +Restart=on-failure + +[Install] +WantedBy=multi-user.target |