diff --git a/CMakeLists.txt b/CMakeLists.txt index b4e33d2..81b0a69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,13 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/static/start.html" IMMEDIATE @ONLY) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/mars-nwe-webui.service.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/mars-nwe-webui.service" + @ONLY +) + + ################################# # Compiler Switches ############## @@ -79,8 +86,11 @@ install(FILES static/smart_icon.jpg DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECD install(FILES static/smart.jpg DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}/static) install(FILES static/favicon.ico DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}/static) - +if(WITH_SYSTEMD) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mars-nwe-webui.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR}) +endif() install(TARGETS check_login DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}) install(TARGETS nwwebui DESTINATION ${CMAKE_INSTALL_SBINDIR}) + diff --git a/mars-nwe-webui.service.cmake b/mars-nwe-webui.service.cmake new file mode 100644 index 0000000..43e6629 --- /dev/null +++ b/mars-nwe-webui.service.cmake @@ -0,0 +1,23 @@ +[Unit] +Description=MARS NWE Web UI +After=network.target mars-nwe-serv.service +Wants=network.target +Documentation=man:systemd.service(5) + +[Service] +Type=simple +User=root +Group=root +WorkingDirectory=/ + +ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/nwwebui -c @MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf +Restart=on-failure +RestartSec=2 + +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=full +ProtectHome=true + +[Install] +WantedBy=multi-user.target