mirror of
https://github.com/mpromonet/v4l2rtspserver
synced 2024-11-03 23:15:56 +00:00
add systemd startup script
This commit is contained in:
parent
fdb5b9a708
commit
f7136b173b
@ -97,6 +97,19 @@ target_link_libraries(${PROJECT_NAME} ${LIBLIVE555_LIBRARIES})
|
||||
enable_testing()
|
||||
add_test(help ./${PROJECT_NAME} -h)
|
||||
|
||||
#systemd
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(SYSTEMD systemd QUIET)
|
||||
if (SYSTEMD_FOUND)
|
||||
message(STATUS "SystemD available")
|
||||
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=systemdsystemunitdir systemd OUTPUT_VARIABLE SYSTEMD_SERVICES_INSTALL_DIR)
|
||||
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SERVICES_INSTALL_DIR "${SYSTEMD_SERVICES_INSTALL_DIR}")
|
||||
message(STATUS "SystemD directory '${SYSTEMD_SERVICES_INSTALL_DIR}'")
|
||||
|
||||
configure_file(v4l2rtspserver.service.in ${CMAKE_CURRENT_BINARY_DIR}/v4l2rtspserver.service @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/v4l2rtspserver.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR} COMPONENT data)
|
||||
endif (SYSTEMD_FOUND)
|
||||
|
||||
# package
|
||||
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
|
||||
|
6
v4l2rtspserver.service.in
Normal file
6
v4l2rtspserver.service.in
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=V4L2 RTSP server
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/v4l2rtspserver
|
Loading…
Reference in New Issue
Block a user