From: Guus Sliepen Date: Sat, 4 Nov 2017 13:17:27 +0000 (+0100) Subject: Support autoconf's --runstatedir option. X-Git-Tag: release-1.0.33~4 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=afda1d91ae290ac2aa2a45d07fa6838b3159da39 Support autoconf's --runstatedir option. Put the PID file in @runstatedir@ instead of @localstatedir@/run. This requires autoconf 2.70, which is not released yet, so add a fallback to use @localstatedir@/run if @runstatedir@ is not set. --- diff --git a/configure.ac b/configure.ac index e4079bb5..72877268 100644 --- a/configure.ac +++ b/configure.ac @@ -242,6 +242,11 @@ AC_ARG_ENABLE(jumbograms, ] ) +dnl Ensure runstatedir is set if we are using a version of autoconf that does not suppport it +if test "x$runstatedir" = "x"; then + AC_SUBST([runstatedir], ['${localstatedir}/run']) +fi + AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile distro/Makefile]) AC_OUTPUT diff --git a/doc/Makefile.am b/doc/Makefile.am index 16b5a71c..fed46b75 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -21,6 +21,7 @@ substitute = sed \ -e s,'@PACKAGE\@',"$(PACKAGE)",g \ -e s,'@VERSION\@',"$(VERSION)",g \ -e s,'@sysconfdir\@',"$(sysconfdir)",g \ + -e s,'@runstatedir\@',"$(runstatedir)",g \ -e s,'@localstatedir\@',"$(localstatedir)",g tincd.8: $(srcdir)/tincd.8.in diff --git a/doc/tinc.conf.5.in b/doc/tinc.conf.5.in index 40ea1cc7..cd7d1a0d 100644 --- a/doc/tinc.conf.5.in +++ b/doc/tinc.conf.5.in @@ -222,7 +222,7 @@ Also note that this can cause decrypted VPN packets to be sent out on a real net Create a UNIX socket with the filename specified by .Va Device , or -.Pa @localstatedir@/run/ Ns Ar NETNAME Ns Pa .umlsocket +.Pa @runstatedir@/ Ns Ar NETNAME Ns Pa .umlsocket if not specified. .Nm tinc will wait for a User Mode Linux instance to connect to this socket. @@ -231,7 +231,7 @@ Uses the libvdeplug library to connect to a Virtual Distributed Ethernet switch, using the UNIX socket specified by .Va Device , or -.Pa @localstatedir@/run/vde.ctl +.Pa @runstatedir@/vde.ctl if not specified. .El Also, in case tinc does not seem to correctly interpret packets received from the virtual network device, diff --git a/doc/tinc.texi b/doc/tinc.texi index db35b4a3..f4c866ef 100644 --- a/doc/tinc.texi +++ b/doc/tinc.texi @@ -860,7 +860,7 @@ Also note that this can cause decrypted VPN packets to be sent out on a real net @cindex UML @item uml (not compiled in by default) Create a UNIX socket with the filename specified by -@var{Device}, or @file{@value{localstatedir}/run/@var{netname}.umlsocket} +@var{Device}, or @file{@value{runstatedir}/@var{netname}.umlsocket} if not specified. Tinc will wait for a User Mode Linux instance to connect to this socket. @@ -868,7 +868,7 @@ Tinc will wait for a User Mode Linux instance to connect to this socket. @item vde (not compiled in by default) Uses the libvdeplug library to connect to a Virtual Distributed Ethernet switch, using the UNIX socket specified by -@var{Device}, or @file{@value{localstatedir}/run/vde.ctl} +@var{Device}, or @file{@value{runstatedir}/vde.ctl} if not specified. @end table @@ -1730,7 +1730,7 @@ Write log entries to a file instead of to the system logging facility. If @var{file} is omitted, the default is @file{@value{localstatedir}/log/tinc.@var{netname}.log}. @item --pidfile=@var{file} -Write PID to @var{file} instead of @file{@value{localstatedir}/run/tinc.@var{netname}.pid}. +Write PID to @var{file} instead of @file{@value{runstatedir}/tinc.@var{netname}.pid}. @item --bypass-security Disables encryption and authentication. diff --git a/doc/tincd.8.in b/doc/tincd.8.in index 195869b6..bdccf9d7 100644 --- a/doc/tincd.8.in +++ b/doc/tincd.8.in @@ -109,7 +109,7 @@ is omitted, the default is Write PID to .Ar FILE instead of -.Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid. +.Pa @runstatedir@/tinc. Ns Ar NETNAME Ns Pa .pid. Under Windows this option will be ignored. .It Fl -bypass-security Disables encryption and authentication of the meta protocol. @@ -190,7 +190,7 @@ This will log all network traffic over the virtual private network. Directory containing the configuration files tinc uses. For more information, see .Xr tinc.conf 5 . -.It Pa @localstatedir@/run/tinc. Ns Ar NETNAME Ns Pa .pid +.It Pa @runstatedir@/tinc. Ns Ar NETNAME Ns Pa .pid The PID of the currently running .Nm is stored in this file. diff --git a/doc/tincinclude.texi.in b/doc/tincinclude.texi.in index da4adc57..01fee35e 100644 --- a/doc/tincinclude.texi.in +++ b/doc/tincinclude.texi.in @@ -2,3 +2,4 @@ @set PACKAGE @PACKAGE@ @set sysconfdir @sysconfdir@ @set localstatedir @localstatedir@ +@set runstatedir @runstatedir@ diff --git a/src/Makefile.am b/src/Makefile.am index 50831035..7b3dd97d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -86,4 +86,4 @@ if TUNEMU LIBS += -lpcap endif -AM_CPPFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -I $(abs_top_builddir)/ +AM_CPPFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DRUNSTATEDIR=\"$(runstatedir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -I $(abs_top_builddir)/ diff --git a/src/tincd.c b/src/tincd.c index a8b13ecb..279c8723 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -538,7 +538,7 @@ static void make_names(void) { #endif if(!pidfilename) { - xasprintf(&pidfilename, LOCALSTATEDIR "/run/%s.pid", identname); + xasprintf(&pidfilename, RUNSTATEDIR "/%s.pid", identname); } if(!logfilename) { diff --git a/src/uml_device.c b/src/uml_device.c index 5c9a306e..ee9e03f4 100644 --- a/src/uml_device.c +++ b/src/uml_device.c @@ -65,7 +65,7 @@ static bool setup_device(void) { struct timeval tv; if(!get_config_string(lookup_config(config_tree, "Device"), &device)) { - xasprintf(&device, LOCALSTATEDIR "/run/%s.umlsocket", identname); + xasprintf(&device, RUNSTATEDIR "/%s.umlsocket", identname); } get_config_string(lookup_config(config_tree, "Interface"), &iface); diff --git a/src/vde_device.c b/src/vde_device.c index d97a694f..20302b0d 100644 --- a/src/vde_device.c +++ b/src/vde_device.c @@ -50,7 +50,7 @@ static bool setup_device(void) { } if(!get_config_string(lookup_config(config_tree, "Device"), &device)) { - xasprintf(&device, LOCALSTATEDIR "/run/vde.ctl"); + xasprintf(&device, RUNSTATEDIR "/vde.ctl"); } get_config_string(lookup_config(config_tree, "Interface"), &iface);