mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 04:26:02 +00:00
Added support for installing a systemd unit file for wesnothd
This commit is contained in:
parent
a37bd824eb
commit
c62cccd0ab
@ -412,6 +412,7 @@ if(ENABLE_GAME OR ENABLE_TESTS)
|
||||
find_package( PkgConfig REQUIRED )
|
||||
pkg_check_modules( PANGOCAIRO REQUIRED pangocairo>=1.14.8 )
|
||||
pkg_check_modules( FONTCONFIG REQUIRED fontconfig>=2.4.1 )
|
||||
pkg_check_modules( SYSTEMD systemd )
|
||||
endif(NOT MSVC)
|
||||
|
||||
endif(ENABLE_GAME OR ENABLE_TESTS)
|
||||
@ -502,6 +503,13 @@ endif(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)
|
||||
|
||||
if(ENABLE_SERVER AND FIFO_DIR)
|
||||
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV{DESTDIR}/${FIFO_DIR})")
|
||||
# install systemd stuff if it is installed
|
||||
if(SYSTEMD_FOUND)
|
||||
configure_file(packaging/systemd/wesnothd.tmpfiles.conf.in ${CMAKE_BINARY_DIR}/wesnothd.conf)
|
||||
configure_file(packaging/systemd/wesnothd.service.in ${CMAKE_BINARY_DIR}/wesnothd.service)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/wesnothd.conf DESTINATION lib/tmpfiles.d)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/wesnothd.service DESTINATION lib/systemd/system)
|
||||
endif()
|
||||
if(SERVER_UID AND SERVER_GID)
|
||||
install(CODE "execute_process(COMMAND chown ${SERVER_UID}:${SERVER_GID} \$ENV{DESTDIR}/${FIFO_DIR})")
|
||||
endif()
|
||||
|
@ -59,6 +59,7 @@ opts.AddVariables(
|
||||
PathVariable('fifodir', 'directory for the wesnothd fifo socket file', "/var/run/wesnothd", PathVariable.PathAccept),
|
||||
BoolVariable('fribidi','Clear to disable bidirectional-language support', True),
|
||||
BoolVariable('desktop_entry','Clear to disable desktop-entry', True),
|
||||
BoolVariable('systemd','Install systemd unit file for wesnothd', bool(WhereIs("systemd"))),
|
||||
PathVariable('datarootdir', 'sets the root of data directories to a non-default location', "share", PathVariable.PathAccept),
|
||||
PathVariable('datadirname', 'sets the name of data directory', "wesnoth$version_suffix", PathVariable.PathAccept),
|
||||
PathVariable('desktopdir', 'sets the desktop entry directory to a non-default location', "$datarootdir/applications", PathVariable.PathAccept),
|
||||
@ -461,7 +462,7 @@ else:
|
||||
env["svnrev"] = ""
|
||||
|
||||
Export(Split("env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs"))
|
||||
SConscript(dirs = Split("po doc packaging/windows"))
|
||||
SConscript(dirs = Split("po doc packaging/windows packaging/systemd"))
|
||||
|
||||
binaries = Split("wesnoth wesnothd cutter exploder campaignd test")
|
||||
builds = {
|
||||
@ -572,6 +573,9 @@ if not access(fifodir, F_OK):
|
||||
])
|
||||
AlwaysBuild(fifodir)
|
||||
env.Alias("install-wesnothd", fifodir)
|
||||
if env["systemd"]:
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.service", "lib/systemd/system")
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.conf", "lib/tmpfiles.d")
|
||||
|
||||
# Wesnoth campaign server
|
||||
env.InstallBinary(campaignd)
|
||||
|
4
packaging/systemd/SConscript
Normal file
4
packaging/systemd/SConscript
Normal file
@ -0,0 +1,4 @@
|
||||
Import("env")
|
||||
|
||||
env.ScanReplace("wesnothd.service", "wesnothd.service.scons.in")
|
||||
env.ScanReplace("wesnothd.conf", "wesnothd.tmpfiles.conf.in")
|
9
packaging/systemd/wesnothd.service.in
Normal file
9
packaging/systemd/wesnothd.service.in
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Wesnoth Server Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=@CMAKE_INSTALL_PREFIX@/@BINDIR@/wesnothd
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
9
packaging/systemd/wesnothd.service.scons.in
Normal file
9
packaging/systemd/wesnothd.service.scons.in
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Wesnoth Server Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=%bindir/wesnothd
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
1
packaging/systemd/wesnothd.tmpfiles.conf.in
Normal file
1
packaging/systemd/wesnothd.tmpfiles.conf.in
Normal file
@ -0,0 +1 @@
|
||||
d @FIFO_DIR@ 0700 root root -
|
Loading…
x
Reference in New Issue
Block a user