diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-11 21:01:35 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-11 21:01:35 +0200 |
commit | 94c29f6b6180dca91ae4034ffcb50c6a5c171b75 (patch) | |
tree | ba75fd15d2cfe18cb083dc04267c58a63ae28208 | |
parent | 4d759daeec0abf98294ece5a689c608890ffb4d1 (diff) | |
download | pies-94c29f6b6180dca91ae4034ffcb50c6a5c171b75.tar.gz pies-94c29f6b6180dca91ae4034ffcb50c6a5c171b75.tar.bz2 |
Final cleanup for version 1.2.
* configure.ac (INETD_SH): Rename to INETD.
* NEWS: Update.
* src/.gitignore (inetd.sh): rename to inetd.
* doc/pies.texi: Update.
* src/Makefile.am (pkgstatedir): New variable.
(AM_CPPFLAGS): Add define.
(inetd.sh): Replace with inetd.
(install-exec-hook): Remove.
* src/pies.c (statedir): New variable.
(pies_keywords): New keyword: "state-directory".
(set_file_names): Split in two functions:
(set_conf_file_names, set_state_file_names).
(main): Call set_conf_file_names before,
and set_state_file_names after parsing the configs.
-rw-r--r-- | NEWS | 54 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | doc/pies.texi | 28 | ||||
-rw-r--r-- | src/.gitignore | 2 | ||||
-rw-r--r-- | src/Makefile.am | 25 | ||||
-rw-r--r-- | src/pies.c | 34 |
6 files changed, 101 insertions, 46 deletions
@@ -1,16 +1,62 @@ -GNU Pies NEWS -- history of user-visible changes. 2009-10-26 +GNU Pies NEWS -- history of user-visible changes. 2009-12-11 Copyright (C) 2009 Sergey Poznyakoff See the end of file for copying conditions. -Please send Pies bug reports to <bug-pies@gnu.org.ua> +Please send Pies bug reports to <bug-pies@gnu.org> or +<bug-pies@gnu.org.ua> -Version 1.1.90 (Git) +Version 1.2, 2009-12-11 -Pies dubbed a GNU package. +* First release as a GNU package. + +* Full inetd support + +The program supports all types of services (including built-in +ones) and all types of protocols offered by the traditional `inetd' +utility. + +The `inetd.conf' configuration file format is supported. The +`inetd' configuration file may be supplied either from the command +line (see below), or via the `include-inetd' configuration statement. + +* Inetd replacement + +A replacement script for inetd(8) is provided. It is fully +compatible with the traditional inetd command line, but offers +the flexibility and new features of pies. + +* Configuration file handling + +Several configuration files, eventually of different types, +can be specified in the command line. New command line +option `--syntax' declares the syntax of configuration +files that follow it, e.g.: + +pies --config-file /etc/pies.conf \ + --syntax=inetd --config-file /etc/inetd.conf \ + --syntax=meta1 --config-file /etc/meta1/meta1.conf + +* New keywords. + +Component keywords: flags, service, socket-type, +max-instances, max-rate, qotd-file. +Global keywords: state-directory, include-inetd. + +* New option --instance + +The `--instance' option allows you to run several instances +of pies, each of them using separate configuration and +state files. + +* New option --rate + +For compatibility with inetd. + +* Improved status output. Version 1.1, 2009-10-20 * Account for possible system clock inaccuracies. * Improve documentation. diff --git a/configure.ac b/configure.ac index 15c2835..3e138cf 100644 --- a/configure.ac +++ b/configure.ac @@ -12,13 +12,13 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ([2.63]) -AC_INIT([GNU Pies], [1.1.90], [bug-pies@gnu.org.ua]) +AC_INIT([GNU Pies], [1.2], [bug-pies@gnu.org.ua]) AC_CONFIG_SRCDIR([src/pies.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 std-options silent-rules]) # Enable silent rules by default: @@ -68,13 +68,13 @@ AM_GNU_GETTEXT([external], [need-formatstring-macros]) AM_GNU_GETTEXT_VERSION([0.17]) AC_ARG_ENABLE([inetd], AC_HELP_STRING([--enable-inetd], [build and install a replacement for SBINDIR/inetd]), [case $enableval in - yes) AC_SUBST([INETD_SH], [inetd.sh]);; + yes) AC_SUBST([INETD], [inetd]);; no) ;; esac]) # Doc hints. # Select a rendition level: # DISTRIB for stable releases (at most one dot in the version number) diff --git a/doc/pies.texi b/doc/pies.texi index 04c85a4..b6f2c91 100644 --- a/doc/pies.texi +++ b/doc/pies.texi @@ -274,15 +274,15 @@ the end of the command line or the next occurrence of the @option{--syntax} option. This means that you can instruct @command{pies} to read several configuration files of various formats in a single command line, e.g.: @smallexample @group -pies /etc/pies.conf \ - --syntax=inetd --config-file /etc/inetd.conf \ - --syntax=meta1 --config-file /etc/meta1/meta1.conf +pies --config-file /etc/pies.conf \ + --syntax=inetd --config-file /etc/inetd.conf \ + --syntax=meta1 --config-file /etc/meta1/meta1.conf @end group @end smallexample @xopindex{config-help, introduced} The rest of this chapter concerns the @command{pies} native configuration file format. You can receive a concise summary of all @@ -2048,17 +2048,24 @@ Retain all supplementary groups the user (as given with start @command{jabberd} components: @uref{http://www.gnu.org.ua/@/software/@/pies/@/example.php?what=jabberd2}. @node State Files @section State Files @cindex state files - Pies uses several files to keep its state information. These files -are kept in local state directory (usually @file{/var/run/pies}, or -@file{/usr/local/var/run/pies}). The table below describes these -files. The @var{instance} in this table stands for the @command{pies} -instance name (@pxref{instances}). Usually, it is @samp{pies}. + Pies uses several files to keep its state information. The +directory which hosts these files is called @dfn{state directory}, it +is usually @file{/var/pies} or @file{/usr/local/var/pies}). The state +directory can be configured at run time: + +@deffn {Config} state-directory @var{dir} +Set the program state directory. +@end deffn + +The table below describes the files kept in the state directory. The +@var{instance} in this table stands for the @command{pies} instance +name (@pxref{instances}). Usually, it is @samp{pies}. @table @asis @item @file{@var{instance}.pid} The @dfn{PID file}. It keeps the PID number of the running @command{pies} instance. @@ -2073,14 +2080,15 @@ The @dfn{statistics file}. Used by @command{pies --status}. @item @file{@var{instance}.qotd} The @dfn{Quotation-of-the-day file}. It is used by the @samp{qotd} built-in service (@pxref{qotd}). @end table The following statements allow to redefine state file names. -Use them only if the defaults does not suit your needs, and the -@option{--instance} option does not help: +Use them only if the defaults do not suit your needs, and niether +the @code{state-directory} statement nor the @option{--instance} +can help: @deffn {Config} pidfile @var{file} Sets the PID file name. @end deffn @deffn {Config} control-file @var{file} diff --git a/src/.gitignore b/src/.gitignore index fe9c6fe..18a7111 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,7 +1,7 @@ -inetd.sh +inetd meta1gram.c meta1gram.h meta1gram.output meta1lex.c pies pies.rc diff --git a/src/Makefile.am b/src/Makefile.am index 98815b0..856efe8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,31 +54,26 @@ INCLUDES = \ LDADD = \ ../lib/libpies.a\ ../grecs/src/libgrecs.a\ ../gnu/libgnu.a\ $(MF_PROCTITLE_LIBS) +pkgstatedir=$(localstatedir)/pies + AM_CPPFLAGS=\ -DDEFAULT_PREPROCESSOR="$(DEFAULT_PREPROCESSOR)"\ -DDEFAULT_VERSION_INCLUDE_DIR=\"$(incdir)\"\ - -DDEFAULT_INCLUDE_DIR=\"$(pkgdatadir)/include\" + -DDEFAULT_INCLUDE_DIR=\"$(pkgdatadir)/include\"\ + -DDEFAULT_STATE_DIR=\"$(pkgstatedir)\" AM_YFLAGS=-dvt -pmeta1 AM_LFLAGS=-dvp -Pmeta1 -olex.yy.c -SUFFIXES = .in .sh EXTRA_SCRIPTS = inetd.in -sbin_SCRIPTS = @INETD_SH@ -inetd.sh: inetd.in +sbin_SCRIPTS = @INETD@ -.in.sh: - $(AM_V_GEN)sed 's|_SBINDIR_|$(sbindir)|' $< > $@ +inetd: inetd.in + $(AM_V_GEN)sed 's|_SBINDIR_|$(sbindir)|' \ + $(top_srcdir)/src/inetd.in > $(top_builddir)/src/inetd -install-exec-hook: - if test -n "@INETD_SH@" && \ - test -f $(DESTDIR)$(sbindir)/@INETD_SH@; then \ - test -f $(DESTDIR)$(sbindir)/inetd$(EXEEXT) && \ - cd $(DESTDIR)$(sbindir) && \ - mv -f inetd$(EXEEXT) inetd$(EXEEXT)~; \ - cd $(DESTDIR)$(sbindir) && \ - mv @INETD_SH@ inetd$(EXEEXT); \ - fi +install-data-hook: + test -d $(DESTDIR)$(pkgstatedir) || $(MKDIR_P) $(pkgstatedir) @@ -24,12 +24,13 @@ int lint_mode; /* Test configuration syntax and exit */ int log_to_stderr_only; /* Use only stderr for logging */ int log_facility = LOG_USER; char *log_tag; struct pies_privs pies_privs; int foreground; int command; +char *statedir = DEFAULT_STATE_DIR; char *instance; char *pidfile; char *ctlfile; char *statfile; char *qotdfile; int inetd_mode; @@ -1418,12 +1419,16 @@ struct grecs_keyword pies_keywords[] = { N_("Set debug verbosity level."), grecs_type_uint, &debug_level, 0, NULL}, {"source-info", NULL, N_("Show source info with debugging messages."), grecs_type_bool, &source_info_option, 0, NULL}, + {"state-directory", + NULL, + N_("Full file name of the program state directory."), + grecs_type_string, &statedir, 0, NULL}, {"pidfile", NULL, N_("Write PID to this file."), grecs_type_string, &pidfile, 0, NULL, }, @@ -2167,34 +2172,34 @@ mkfilename (const char *dir, const char *name, const char *suf) strcat (s, "/"); strcat (s, name); strcat (s, suf); return s; } -void -set_file_names (const char *base) +static void +set_conf_file_names (const char *base) { - const char *p; - - p = strrchr (base, '/'); - if (p) - base = p + 1; if (!conf_head) { char *name = mkfilename (SYSCONFDIR, base, ".conf"); add_config (current_syntax, name); free (name); } +} + +static void +set_state_file_names (const char *base) +{ if (!pidfile) - pidfile = mkfilename (LOCALSTATEDIR, base, ".pid"); + pidfile = mkfilename (statedir, base, ".pid"); if (!ctlfile) - ctlfile = mkfilename (LOCALSTATEDIR, base, ".ctl"); + ctlfile = mkfilename (statedir, base, ".ctl"); if (!statfile) - statfile = mkfilename (LOCALSTATEDIR, base, ".stat"); + statfile = mkfilename (statedir, base, ".stat"); if (!qotdfile) - qotdfile = mkfilename (LOCALSTATEDIR, base, ".qotd"); + qotdfile = mkfilename (statedir, base, ".qotd"); } int main (int argc, char **argv) { int index; @@ -2226,16 +2231,16 @@ main (int argc, char **argv) instance = strrchr (program_name, '/'); if (!instance) instance = (char*) program_name; else instance++; } - else - log_tag = instance; - set_file_names (instance); + log_tag = instance; + + set_conf_file_names (instance); if (!DEFAULT_PREPROCESSOR) grecs_preprocessor = NULL; else { grecs_preprocessor = obstack_finish (&pp_stk); @@ -2271,12 +2276,13 @@ main (int argc, char **argv) if (meta1_config_parse (file->name)) exit (EX_CONFIG); break; } } + set_state_file_names (instance); set_mailer_argcv (); if (lint_mode) { progman_build_depmap (); exit (0); |