forked from ReimuNotMoe/ydotool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update usage for system/user services with options
- Loading branch information
Andre Paiusco
committed
May 2, 2024
1 parent
27e9ebf
commit 203b020
Showing
3 changed files
with
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,29 @@ | ||
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) | ||
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 | ||
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() | ||
# else() | ||
# set(SD_UNITDIR "lib/systemd/user") | ||
endif() | ||
|
||
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}) | ||
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