Fix path to mbusd binary in systemd service file (#27)

This commit is contained in:
Victor Antonovich 2018-02-20 23:42:19 +03:00
parent 650d88a269
commit cb03e4ac1c
3 changed files with 13 additions and 7 deletions

View File

@ -1,12 +1,13 @@
cmake_minimum_required(VERSION 3.2)
project(mbusd VERSION 0.3.1)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/extern_GPL)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(GNUInstallDirs)
include(FindSystemd)
project(mbusd VERSION 0.3.0)
#TODO ISC_Posix, prog_libtool
# single-configuration generator setup
SET(BASIC_C_FLAGS "-W -pedantic -fno-builtin-log -Wall")
@ -73,7 +74,7 @@ install(TARGETS mbusd DESTINATION bin)
# aggregate the man page template
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/mbusd.8.in mbusd.8)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mbusd.8 DESTINATION share/man/man8)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mbusd.8 DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/man/man8)
# install example configuration file
install(
@ -85,7 +86,7 @@ if(SYSTEMD_FOUND)
message(STATUS "Systemd service file will be installed to ${SYSTEMD_SERVICES_INSTALL_DIR}")
# aggregate mbusd@.service from its template
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/systemd-units/mbusd@.service.in mbusd@.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mbusd@.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mbusd@.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR})
endif()
# uninstall target
@ -140,4 +141,9 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_SOURCE_STRIP_FILES TRUE)
set(CPACK_STRIP_FILES TRUE)
#the include must be after all the cpack concerning set's
include(CPack)
include(CPack)
message(STATUS "Install prefix ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Install bindir: ${CMAKE_INSTALL_FULL_BINDIR}")
message(STATUS "Install sysconfdir: ${CMAKE_INSTALL_FULL_SYSCONFDIR}")
message(STATUS "Install datadir: ${CMAKE_INSTALL_FULL_DATADIR}")

View File

@ -36,7 +36,7 @@ Installation instructions:
$ git clone https://github.com/3cky/mbusd.git mbusd.git
$ cd mbusd.git
$ mkdir -p build && cd build
$ cmake ../
$ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
$ make
$ sudo make install
```

View File

@ -3,7 +3,7 @@ Description=Modbus TCP to Modbus RTU (RS-232/485) gateway.
Requires=network.target
[Service]
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/mbusd -d -v2 -L - -c /etc/mbusd/mbusd-%i.conf -p /dev/%i
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/mbusd -d -v2 -L - -c @CMAKE_INSTALL_FULL_SYSCONFDIR@/mbusd/mbusd-%i.conf -p /dev/%i
Restart=on-failure
RestartSec=1
StandardOutput=journal