Add config files for systemd-tmpfiles and systemd-sysusers

Let systemd handle user creation, let it create the runtime dir and clean
up files in /tmp.
This commit is contained in:
Fabian Vogt 2023-02-06 10:49:05 +01:00
parent bf69d7bada
commit 0a54d3abbb
4 changed files with 29 additions and 4 deletions

View File

@ -139,8 +139,15 @@ if(SYSTEMD_FOUND)
endif()
if (NOT DEFINED SYSTEMD_SYSTEM_UNIT_DIR)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=systemdsystemunitdir systemd OUTPUT_VARIABLE SYSTEMD_SYSTEM_UNIT_DIR)
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SYSTEM_UNIT_DIR ${SYSTEMD_SYSTEM_UNIT_DIR})
pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)
endif()
if (NOT DEFINED SYSTEMD_SYSUSERS_DIR)
pkg_get_variable(SYSTEMD_SYSUSERS_DIR systemd sysusersdir)
endif()
if (NOT DEFINED SYSTEMD_TMPFILES_DIR)
pkg_get_variable(SYSTEMD_TMPFILES_DIR systemd tmpfilesdir)
endif()
set(HALT_COMMAND "/usr/bin/systemctl poweroff")

View File

@ -1,7 +1,15 @@
if(SYSTEMD_FOUND)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/sddm.service.in" "${CMAKE_CURRENT_BINARY_DIR}/sddm.service")
configure_file(sddm.service.in sddm.service)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sddm.service" DESTINATION "${SYSTEMD_SYSTEM_UNIT_DIR}")
configure_file(sddm-sysuser.conf.in sddm-sysuser.conf)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sddm-sysuser.conf" DESTINATION "${SYSTEMD_SYSUSERS_DIR}" RENAME sddm.conf)
endif()
# systemd-tmpfiles can be used standalone without other systemd parts
if(DEFINED SYSTEMD_TMPFILES_DIR)
configure_file(sddm-tmpfiles.conf.in sddm-tmpfiles.conf)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sddm-tmpfiles.conf" DESTINATION "${SYSTEMD_TMPFILES_DIR}" RENAME sddm.conf)
endif()
if(USE_ELOGIND)

View File

@ -0,0 +1,2 @@
#Type Name ID GECOS Home directory Shell
u sddm - "SDDM Greeter Account" ${STATE_DIR} -

View File

@ -0,0 +1,8 @@
# Home dir of the sddm user, also contains state.conf
d ${STATE_DIR} 0750 sddm sddm
# This contains X11 auth files passed to Xorg and the greeter
d ${RUNTIME_DIR} 0711 root root
# Sockets for IPC
r! /tmp/sddm-auth*
# xauth files passed to user sessions
r! /tmp/xauth_*