build: install systemd service and PAM configuration

This commit is contained in:
Mario Fetka
2026-04-21 17:57:18 +02:00
parent e5c4fb8045
commit 206dbfa073
3 changed files with 41 additions and 1 deletions

View File

@@ -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
##############
@@ -67,6 +74,7 @@ target_link_libraries(check_login
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/smart.conf DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/smart DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(FILES smart.pamd DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d RENAME smart)
install(PROGRAMS apply.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(PROGRAMS readconfig.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
@@ -79,8 +87,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})

View File

@@ -0,0 +1,25 @@
[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=/
ExecStartPre=/bin/mkdir -p @MARS_NWE_LOG_DIR@
ExecStartPre=/bin/mkdir -p @MARS_NWE_PID_DIR@
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

4
smart.pamd Normal file
View File

@@ -0,0 +1,4 @@
auth required pam_unix.so
account required pam_unix.so
password required pam_unix.so
session required pam_unix.so