-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from Paiusco/create-split-systemd-system-user…
…-service Create CMake option for systemd system/user service
- Loading branch information
Showing
7 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/ydotoold.service.in" | ||
"${PROJECT_BINARY_DIR}/ydotoold.service" | ||
@ONLY) | ||
install(FILES "${PROJECT_BINARY_DIR}/ydotoold.service" DESTINATION ${SD_UNITDIR}) | ||
option(SYSTEMD_USER_SERVICE "Install systemd user service file" ON) | ||
option(SYSTEMD_SYSTEM_SERVICE "Install systemd system service file" OFF) | ||
option(OPENRC "Install OpenRC service file" OFF) # To be implemented | ||
|
||
if(SYSTEMD_USER_SERVICE AND SYSTEMD_SYSTEM_SERVICE) | ||
message(FATAL_ERROR "Both system and user services are enabled. Choose one.") | ||
endif() | ||
|
||
if(SYSTEMD_USER_SERVICE OR SYSTEMD_SYSTEM_SERVICE) | ||
add_subdirectory(systemd) | ||
endif() | ||
|
||
if(OPENRC) | ||
add_subdirectory(openrc) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TBD |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
find_package(PkgConfig) | ||
|
||
# Try to get the systemd directory for system/user units from the package | ||
# and fall back on upstream default without the '/usr' prefix if not forced by | ||
# command line. | ||
pkg_check_modules(SYSTEMD systemd) | ||
if (SYSTEMD_FOUND) | ||
if(SYSTEMD_USER_SERVICE) | ||
pkg_get_variable(SD_UNITDIR systemd systemduserunitdir) | ||
elseif(SYSTEMD_SYSTEM_SERVICE) | ||
pkg_get_variable(SD_UNITDIR systemd systemdsystemunitdir) | ||
endif() | ||
endif() | ||
|
||
if(NOT DEFINED SD_UNITDIR) | ||
set(SD_UNITDIR "lib/systemd/user") | ||
endif() | ||
|
||
message("Systemd service file is going to be installed at ${SD_UNITDIR}") | ||
|
||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/ydotoold.service.in" | ||
"${PROJECT_BINARY_DIR}/ydotoold.service" | ||
@ONLY) | ||
install(FILES "${PROJECT_BINARY_DIR}/ydotoold.service" DESTINATION ${SD_UNITDIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters