Browse Source

Create a systemd service file for tdm

Signed-off-by: aneejit1 <aneejit1@gmail.com>
(cherry picked from commit 5f47d4f481)
r14.0.x
aneejit1 2 years ago committed by Slávek Banko
parent
commit
87ed5c26dc
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668
  1. 1
      CMakeLists.txt
  2. 6
      tdm/CMakeLists.txt
  3. 78
      tdm/ConfigureChecks.cmake
  4. 13
      tdm/tdm.service.cmake
  5. 12
      tdm/tdm.service.debian.cmake
  6. 13
      tdm/tdm.service.fedora-18.cmake
  7. 13
      tdm/tdm.service.fedora-19.cmake
  8. 13
      tdm/tdm.service.fedora.cmake
  9. 13
      tdm/tdm.service.rhel.cmake
  10. 12
      tdm/tdm.service.ubuntu.cmake

1
CMakeLists.txt

@ -165,6 +165,7 @@ option( BUILD_KDIALOG "Build kdialog" ${BUILD_ALL} )
option( BUILD_KREADCONFIG "Build kreadconfig" ${BUILD_ALL} )
option( BUILD_TDESU "Build tdesu" ${BUILD_ALL} )
option( BUILD_TDM "Build tdm" ${BUILD_ALL} )
option( BUILD_TDM_SYSTEMD_UNIT_FILE "Build tdm service file for systemd" OFF )
option( BUILD_KSMSERVER "Build ksmserver" ${BUILD_ALL} )
option( BUILD_KSPLASHML "Build ksplashml" ${BUILD_ALL} )
option( BUILD_STARTTDE "Build starttde" ${BUILD_ALL} )

6
tdm/CMakeLists.txt

@ -21,3 +21,9 @@ include( ConfigureChecks.cmake )
add_subdirectory( backend )
add_subdirectory( kfrontend )
# systemd
if( BUILD_TDM_SYSTEMD_UNIT_FILE AND NOT "${SYSTEMDSYSTEMUNITDIR}" STREQUAL "" )
configure_file( "${TDM_SERVICE_FILE_TEMPLATE}" tdm.service @ONLY )
install( FILES "${CMAKE_CURRENT_BINARY_DIR}/tdm.service" DESTINATION ${SYSTEMDSYSTEMUNITDIR} )
endif( )

78
tdm/ConfigureChecks.cmake

@ -128,3 +128,81 @@ elseif( WITH_SHADOW )
set( USESHADOW 1 CACHE INTERNAL "" FORCE )
endif( )
# If a tdm.service file is wanted, find systemd, then work out which
# distribution is running, select an appropriate template and create the file.
# When it is not possible to identify the distribution or there is no specific
# template is available, use the default of 'tde.service.cmake'. The template
# can also be set from the command line.
if( BUILD_TDM_SYSTEMD_UNIT_FILE )
if( NOT SYSTEMDSYSTEMUNITDIR )
pkg_search_module( SYSTEMD systemd )
if( SYSTEMD_FOUND )
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=systemdsystemunitdir systemd
OUTPUT_VARIABLE SYSTEMDSYSTEMUNITDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif( )
endif( )
if( "${SYSTEMDSYSTEMUNITDIR}" STREQUAL "" )
set( SYSTEMDSYSTEMUNITDIR "/usr/lib/systemd/system" )
endif( )
if( NOT TDM_SERVICE_FILE_TEMPLATE )
find_program( LSB_RELEASE lsb_release HINTS ENV PATH )
unset( _DIST_ID_LIST )
if( EXISTS "/etc/os-release" )
file( READ "/etc/os-release" _OS_RELEASE )
if( "\n${_OS_RELEASE}" MATCHES "\nID=\"*([^\"\n]*)" )
set( _DISTRIBUTION "${CMAKE_MATCH_1}" )
endif( )
if( "\n${_OS_RELEASE}" MATCHES "\nVERSION_ID=\"*([^\\.\"\n]*)" )
set( _DIST_VERSION "${CMAKE_MATCH_1}" )
endif( )
if( "\n${_OS_RELEASE}" MATCHES "\nID_LIKE=\"*([^\\.\"\n]*)" )
string( REGEX REPLACE " " ";" _DIST_ID_LIST "${CMAKE_MATCH_1}" )
endif( )
if( _DISTRIBUTION )
message( STATUS "Running ${_DISTRIBUTION} distribution, version ${_DIST_VERSION}" )
string( TOLOWER "${_DISTRIBUTION}" _DISTRIBUTION )
list( INSERT _DIST_ID_LIST 0 "${_DISTRIBUTION}" )
endif( )
foreach( _DIST_ID IN LISTS _DIST_ID_LIST )
if( NOT TDM_SERVICE_FILE_TEMPLATE )
if( _DIST_VERSION AND
EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tdm.service.${_DIST_ID}-${_DIST_VERSION}.cmake" )
set( TDM_SERVICE_FILE_TEMPLATE "tdm.service.${_DIST_ID}-${_DIST_VERSION}.cmake" )
elseif( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tdm.service.${_DIST_ID}.cmake" )
set( TDM_SERVICE_FILE_TEMPLATE "tdm.service.${_DIST_ID}.cmake" )
endif( )
endif( )
endforeach( )
else( )
message(STATUS "**WARNING** /etc/os-release was not found. The default template for tdm.service will be used.")
endif( )
if( NOT TDM_SERVICE_FILE_TEMPLATE )
set( TDM_SERVICE_FILE_TEMPLATE "tdm.service.cmake" )
endif( )
message( STATUS "tdm.service template file is ${TDM_SERVICE_FILE_TEMPLATE}" )
configure_file( "${TDM_SERVICE_FILE_TEMPLATE}" tdm.service @ONLY )
endif( )
endif( )

13
tdm/tdm.service.cmake

@ -0,0 +1,13 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty7.service plymouth-quit.service
After=systemd-user-sessions.service getty@tty7.service plymouth-quit.service
[Service]
ExecStart=@BIN_INSTALL_DIR@/tdm
Restart=always
IgnoreSIGPIPE=no
[Install]
Alias=display-manager.service

12
tdm/tdm.service.debian.cmake

@ -0,0 +1,12 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty7.service plymouth-quit.service
After=systemd-user-sessions.service getty@tty7.service plymouth-quit.service
[Service]
# temporary safety check until all DMs are converted to correct
# display-manager.service symlink handling
ExecStartPre=/bin/sh -c '[ "$(basename $(cat /etc/X11/default-display-manager 2>/dev/null))" = "tdm" ]'
ExecStart=@BIN_INSTALL_DIR@/tdm
Restart=always

13
tdm/tdm.service.fedora-18.cmake

@ -0,0 +1,13 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty1.service plymouth-quit.service
After=systemd-user-sessions.service getty@tty1.service plymouth-quit.service livesys-late.service
[Service]
ExecStart=@BIN_INSTALL_DIR@/tdm
Restart=always
IgnoreSIGPIPE=no
[Install]
Alias=display-manager.service

13
tdm/tdm.service.fedora-19.cmake

@ -0,0 +1,13 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty1.service plymouth-quit.service
After=systemd-user-sessions.service getty@tty1.service plymouth-quit.service
[Service]
ExecStart=@BIN_INSTALL_DIR@/tdm
Restart=always
IgnoreSIGPIPE=no
[Install]
Alias=display-manager.service

13
tdm/tdm.service.fedora.cmake

@ -0,0 +1,13 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty1.service
After=systemd-user-sessions.service getty@tty1.service plymouth-quit.service
[Service]
ExecStart=@BIN_INSTALL_DIR@/tdm
Restart=always
IgnoreSIGPIPE=no
[Install]
Alias=display-manager.service

13
tdm/tdm.service.rhel.cmake

@ -0,0 +1,13 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty1.service
After=systemd-user-sessions.service getty@tty1.service plymouth-quit.service
[Service]
ExecStart=@BIN_INSTALL_DIR@/tdm
Restart=always
IgnoreSIGPIPE=no
[Install]
Alias=display-manager.service

12
tdm/tdm.service.ubuntu.cmake

@ -0,0 +1,12 @@
[Unit]
Description=Trinity Display Manager
Documentation=man:tdm-trinity(1)
Conflicts=getty@tty7.service plymouth-quit.service
After=systemd-user-sessions.service getty@tty7.service plymouth-quit.service
[Service]
# temporary safety check until all DMs are converted to correct
# display-manager.service symlink handling
ExecStartPre=/bin/sh -c '[ "$(basename $(cat /etc/X11/default-display-manager 2>/dev/null))" = "tdm" ]'
ExecStart=@BIN_INSTALL_DIR@/tdm
Restart=always
Loading…
Cancel
Save