fixed bug #9780
now the $localstatedir/wesnothd directory is created with specified uid and gid removed the --fifo command line option
This commit is contained in:
parent
ae5bc2a356
commit
16a3378809
3 changed files with 27 additions and 11 deletions
12
configure.ac
12
configure.ac
|
@ -131,6 +131,18 @@ AC_ARG_ENABLE([server],
|
|||
[server=$enableval],
|
||||
[server=no])
|
||||
|
||||
AC_ARG_WITH([server-uid],
|
||||
AS_HELP_STRING([--with-server-uid]. [user id of the user who runs wesnothd]),
|
||||
[serveruid=$withval],
|
||||
[serveruid=0])
|
||||
AC_SUBST([serveruid])
|
||||
|
||||
AC_ARG_WITH([server-gid],
|
||||
AS_HELP_STRING([--with-server-gid]. [group id of the user who runs wesnothd]),
|
||||
[servergid=$withval],
|
||||
[servergid=0])
|
||||
AC_SUBST([servergid])
|
||||
|
||||
AC_ARG_ENABLE([campaign_server],
|
||||
AS_HELP_STRING([--enable-campaign-server], [enable compilation of campaign server]),
|
||||
[campaignserver=$enableval],
|
||||
|
|
|
@ -538,7 +538,7 @@ wesnoth_zip_SOURCES = \
|
|||
wesnoth_zip_LDADD = @SDL_LIBS@ @SDL_NET_LIBS@
|
||||
|
||||
AM_CXXFLAGS = -I $(srcdir)/sdl_ttf -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" \
|
||||
-DLOCALEDIR=\"$(LOCALEDIR)\" -DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR)
|
||||
-DLOCALEDIR=\"$(LOCALEDIR)\" -DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR) -DLOCALSTATEDIR=\"$(localstatedir)\"
|
||||
|
||||
AM_CFLAGS = -I $(srcdir)/sdl_ttf -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" \
|
||||
-DLOCALEDIR=\"$(LOCALEDIR)\" -DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR)
|
||||
|
@ -571,3 +571,13 @@ endif
|
|||
#-lSDL_image -lSDL_mixer -lSDL_net -lSDL_ttf -lstdc++ -lm -lSM -lICE -ljpeg \
|
||||
#-lpng -lz -lvorbisfile -lvorbis -logg -lsmpeg -lfreetype
|
||||
#endif
|
||||
|
||||
if SERVER
|
||||
install-exec-hook:
|
||||
mkdir -p -m 0700 $(localstatedir)/wesnothd
|
||||
chown $(serveruid):$(servergid) $(localstatedir)/wesnothd
|
||||
|
||||
uninstall-hook:
|
||||
rm -rf $(localstatedir)/wesnothd/
|
||||
|
||||
endif
|
||||
|
|
|
@ -870,7 +870,10 @@ int main(int argc, char** argv)
|
|||
|
||||
network::set_default_send_size(4096);
|
||||
|
||||
std::string fifo_path = "/var/run/wesnothd/socket";
|
||||
#ifndef LOCALSTATEDIR
|
||||
# define LOCALSTATEDIR "/var/run"
|
||||
#endif
|
||||
std::string fifo_path = std::string(LOCALSTATEDIR) + "/wesnothd/socket";
|
||||
|
||||
for(int arg = 1; arg != argc; ++arg) {
|
||||
const std::string val(argv[arg]);
|
||||
|
@ -887,7 +890,6 @@ int main(int argc, char** argv)
|
|||
std::cout << "usage: " << argv[0]
|
||||
<< " [options]\n"
|
||||
<< " -d --daemon Runs wesnothd as a daemon\n"
|
||||
<< " --fifo file Sets the path for the FIFO used to communicate with the server\n"
|
||||
<< " -m, --max_packet_size n Sets the maximal packet size to n\n"
|
||||
<< " -p, --port Binds the server to the specified port\n"
|
||||
<< " -v, --version Returns the server version\n";
|
||||
|
@ -896,14 +898,6 @@ int main(int argc, char** argv)
|
|||
std::cout << "Battle for Wesnoth server " << game_config::version
|
||||
<< "\n";
|
||||
return 0;
|
||||
} else if(val == "--fifo") {
|
||||
++arg;
|
||||
if(arg == argc) {
|
||||
std::cerr << "option --fifo requires a path argument\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
fifo_path = argv[arg];
|
||||
} else if(val == "--daemon" || val == "-d") {
|
||||
#ifdef WIN32
|
||||
std::cerr << "Running as a daemon is not supported on this platform\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue