diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | tdm/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tdm/ConfigureChecks.cmake | 78 | ||||
-rw-r--r-- | tdm/tdm.service.cmake | 13 | ||||
-rw-r--r-- | tdm/tdm.service.debian.cmake | 12 | ||||
-rw-r--r-- | tdm/tdm.service.fedora-18.cmake | 13 | ||||
-rw-r--r-- | tdm/tdm.service.fedora-19.cmake | 13 | ||||
-rw-r--r-- | tdm/tdm.service.fedora.cmake | 13 | ||||
-rw-r--r-- | tdm/tdm.service.rhel.cmake | 13 | ||||
-rw-r--r-- | tdm/tdm.service.ubuntu.cmake | 12 |
10 files changed, 174 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b8051787..a6998c1eb 100644 --- a/CMakeLists.txt +++ b/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} ) diff --git a/tdm/CMakeLists.txt b/tdm/CMakeLists.txt index 08096f84c..692e96e88 100644 --- a/tdm/CMakeLists.txt +++ b/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( ) diff --git a/tdm/ConfigureChecks.cmake b/tdm/ConfigureChecks.cmake index cb5615243..335a37f63 100644 --- a/tdm/ConfigureChecks.cmake +++ b/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( ) diff --git a/tdm/tdm.service.cmake b/tdm/tdm.service.cmake new file mode 100644 index 000000000..0918e9316 --- /dev/null +++ b/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 diff --git a/tdm/tdm.service.debian.cmake b/tdm/tdm.service.debian.cmake new file mode 100644 index 000000000..9222898c4 --- /dev/null +++ b/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 diff --git a/tdm/tdm.service.fedora-18.cmake b/tdm/tdm.service.fedora-18.cmake new file mode 100644 index 000000000..47fb4756b --- /dev/null +++ b/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 diff --git a/tdm/tdm.service.fedora-19.cmake b/tdm/tdm.service.fedora-19.cmake new file mode 100644 index 000000000..f6de77607 --- /dev/null +++ b/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 diff --git a/tdm/tdm.service.fedora.cmake b/tdm/tdm.service.fedora.cmake new file mode 100644 index 000000000..23dc1b32b --- /dev/null +++ b/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 diff --git a/tdm/tdm.service.rhel.cmake b/tdm/tdm.service.rhel.cmake new file mode 100644 index 000000000..23dc1b32b --- /dev/null +++ b/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 diff --git a/tdm/tdm.service.ubuntu.cmake b/tdm/tdm.service.ubuntu.cmake new file mode 100644 index 000000000..9222898c4 --- /dev/null +++ b/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 |