mirror of
https://github.com/Syping/dtranslatebot.git
synced 2024-11-22 13:50:22 +01:00
systemd: escape working directory
This commit is contained in:
parent
7d8bbd12ce
commit
66a504ac55
2 changed files with 12 additions and 2 deletions
|
@ -89,6 +89,16 @@ endif()
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
option(WITH_SYSTEMD "Build with systemd Support" OFF)
|
option(WITH_SYSTEMD "Build with systemd Support" OFF)
|
||||||
if (WITH_SYSTEMD)
|
if (WITH_SYSTEMD)
|
||||||
|
find_program(SYSTEMD_ESCAPE_EXECUTABLE NAMES systemd-escape)
|
||||||
|
if (DEFINED SYSTEMD_ESCAPE_EXECUTABLE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${SYSTEMD_ESCAPE_EXECUTABLE}" "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/dtranslatebot"
|
||||||
|
OUTPUT_VARIABLE dtranslatebot_SERVICE_WORKDIR
|
||||||
|
)
|
||||||
|
string(STRIP "${dtranslatebot_SERVICE_WORKDIR}" dtranslatebot_SERVICE_WORKDIR)
|
||||||
|
else()
|
||||||
|
set(dtranslatebot_SERVICE_WORKDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/dtranslatebot")
|
||||||
|
endif()
|
||||||
configure_file(src/systemd/dtranslatebot.service.in "${dtranslatebot_BINARY_DIR}/systemd/service/dtranslatebot.service" @ONLY)
|
configure_file(src/systemd/dtranslatebot.service.in "${dtranslatebot_BINARY_DIR}/systemd/service/dtranslatebot.service" @ONLY)
|
||||||
configure_file(src/systemd/dtranslatebot.sysusersd.in "${dtranslatebot_BINARY_DIR}/systemd/sysusers.d/dtranslatebot.conf" @ONLY)
|
configure_file(src/systemd/dtranslatebot.sysusersd.in "${dtranslatebot_BINARY_DIR}/systemd/sysusers.d/dtranslatebot.conf" @ONLY)
|
||||||
install(FILES "${dtranslatebot_BINARY_DIR}/systemd/service/dtranslatebot.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system")
|
install(FILES "${dtranslatebot_BINARY_DIR}/systemd/service/dtranslatebot.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system")
|
||||||
|
|
|
@ -5,9 +5,9 @@ After=network.target
|
||||||
[Service]
|
[Service]
|
||||||
User=dtranslatebot
|
User=dtranslatebot
|
||||||
Group=dtranslatebot
|
Group=dtranslatebot
|
||||||
WorkingDirectory="@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/lib/dtranslatebot"
|
WorkingDirectory=@dtranslatebot_SERVICE_WORKDIR@
|
||||||
ExecStart="@CMAKE_INSTALL_FULL_BINDIR@/dtranslatebot" "@CMAKE_INSTALL_FULL_SYSCONFDIR@/dtranslatebot.json"
|
ExecStart="@CMAKE_INSTALL_FULL_BINDIR@/dtranslatebot" "@CMAKE_INSTALL_FULL_SYSCONFDIR@/dtranslatebot.json"
|
||||||
Restart=on-failure
|
Restart=on-abnormal
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in a new issue