1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

doc: Do not used fixed file names in the manuals.

* doc/mkdefsinc.c: New.
* doc/Makefile.am: Include cmacros.am.
(EXTRA_DIST): Add mkdefsinc.c defsincdate.
(BUILT_SOURCES): Add defsincdate
(CLEANFILES): Add mkdefsinc and defs.inc.
(mkdefsinc): New rule.
(yat2m-stamp): Depend on defs.inc.
($(myman_pages) gnupg.7): Ditto.
(gnupg.texi): Remove rule to touch itself.
(dist-hook): New.
(defsincdate): New.
(defs.inc): New.
* doc/gnupg.texi: Remove inclusion of version.texi.  Include defs.inc.
Also include defs.inc in all files used to build man files.  Change
fixed directory names to those from defs.inc.
--

GnuPG-bug-id: 1661
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-06-09 21:29:15 +02:00
parent 255dadd76d
commit 25331bba55
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
15 changed files with 376 additions and 45 deletions

View File

@ -18,6 +18,8 @@
localedir = $(datadir)/locale
# NB: AM_CFLAGS may also be used by tools running on the build
# platform to create source files.
AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"
if ! HAVE_DOSISH_SYSTEM

View File

@ -17,6 +17,10 @@
## Process this file with automake to produce Makefile.in
AM_CPPFLAGS =
include $(top_srcdir)/am/cmacros.am
examples = examples/README examples/scd-event examples/trustlist.txt \
examples/gpgconf.conf examples/pwpattern.list
@ -32,12 +36,12 @@ EXTRA_DIST = samplekeys.asc mksamplekeys \
gnupg-logo.eps gnupg-logo.pdf gnupg-logo.png gnupg-logo-tr.png\
gnupg-card-architecture.eps gnupg-card-architecture.png \
gnupg-card-architecture.pdf \
FAQ gnupg7.texi \
FAQ gnupg7.texi mkdefsinc.c defsincdate \
opt-homedir.texi see-also-note.texi specify-user-id.texi \
gpgv.texi yat2m.c ChangeLog-2011 whats-new-in-2.1.txt
BUILT_SOURCES = gnupg-card-architecture.eps gnupg-card-architecture.png \
gnupg-card-architecture.pdf
gnupg-card-architecture.pdf defsincdate
info_TEXINFOS = gnupg.texi
@ -75,7 +79,7 @@ man_MANS = $(myman_pages) gnupg.7
watchgnupg_SOURCE = gnupg.texi
CLEANFILES = yat2m
CLEANFILES = yat2m mkdefsinc defs.inc
DISTCLEANFILES = gnupg.tmp gnupg.ops yat2m-stamp.tmp yat2m-stamp \
$(myman_pages) gnupg.7
@ -83,6 +87,10 @@ DISTCLEANFILES = gnupg.tmp gnupg.ops yat2m-stamp.tmp yat2m-stamp \
yat2m: yat2m.c
$(CC_FOR_BUILD) -o $@ $(srcdir)/yat2m.c
mkdefsinc: mkdefsinc.c Makefile ../config.h
$(CC_FOR_BUILD) -I. -I.. -I$(srcdir) $(AM_CPPFLAGS) \
-o $@ $(srcdir)/mkdefsinc.c
.fig.png:
fig2dev -L png `test -f '$<' || echo '$(srcdir)/'`$< $@
@ -97,7 +105,7 @@ yat2m: yat2m.c
fig2dev -L pdf `test -f '$<' || echo '$(srcdir)/'`$< $@
yat2m-stamp: $(myman_sources)
yat2m-stamp: $(myman_sources) defs.inc
@rm -f yat2m-stamp.tmp
@touch yat2m-stamp.tmp
for file in $(myman_sources) ; do \
@ -107,7 +115,7 @@ yat2m-stamp: $(myman_sources)
yat2m-stamp: yat2m
$(myman_pages) gnupg.7 : yat2m-stamp
$(myman_pages) gnupg.7 : yat2m-stamp defs.inc
@if test -f $@; then :; else \
trap 'rm -rf yat2m-stamp yat2m-lock' 1 2 13 15; \
if mkdir yat2m-lock 2>/dev/null; then \
@ -120,11 +128,20 @@ $(myman_pages) gnupg.7 : yat2m-stamp
fi; \
fi
# Make sure that gnupg.texi is touched if any other source file has
# been modified. This is required so that the version.texi magic
# updates the release date.
gnupg.texi : $(gnupg_TEXINFOS)
touch $(srcdir)/gnupg.texi
dist-hook: defsincdate
defsincdate: $(gnupg_TEXINFOS)
: >defsincdate ; \
if test -d $(top_srcdir)/.git; then \
(cd $(srcdir) && git log -1 --format='%ct' \
-- $(gnupg_TEXINFOS) 2>/dev/null) >>defsincdate; \
fi
defs.inc : defsincdate Makefile mkdefsinc
incd="`test -f defsincdate || echo '$(srcdir)/'`defsincdate"; \
./mkdefsinc -C $(srcdir) --date "`cat $$incd 2>/dev/null`" \
$(gnupg_TEXINFOS) >$@
online: gnupg.html gnupg.pdf
set -e; \

View File

@ -178,7 +178,7 @@ Pick the key which best matches the creation time and run the command
@cartouche
@smallexample
/usr/local/libexec/gpg-protect-tool --p12-export \
@value{LIBEXECDIR}/gpg-protect-tool --p12-export \
~/.gnupg/private-keys-v1.d/@var{foo} >@var{foo}.p12
@end smallexample
@end cartouche
@ -193,7 +193,7 @@ To import the created file on the machine you use this command:
@cartouche
@smallexample
/usr/local/libexec/gpg-protect-tool --p12-import --store @var{foo}.p12
@value{LIBEXECDIR}/gpg-protect-tool --p12-import --store @var{foo}.p12
@end smallexample
@end cartouche

View File

@ -3,6 +3,8 @@
@c This is part of the GnuPG manual.
@c For copying conditions, see the file gnupg.texi.
@include defs.inc
@node Invoking DIRMNGR
@chapter Invoking DIRMNGR
@cindex DIRMNGR command options
@ -143,8 +145,8 @@ running mode:
@table @asis
@item With @code{--daemon} given on the commandline
the directory named @file{/etc/gnupg} is used for configuration files
and @file{/var/cache/gnupg} for cached CRLs.
the directory named @file{@value{SYSCONFDIR}} is used for configuration files
and @file{@value{LOCALCACHEDIR}} for cached CRLs.
@item Without @code{--daemon} given on the commandline
the directory named @file{.gnupg} directly below the home directory
@ -456,7 +458,7 @@ These certificates are first tried before going
out to the net to look for them. These certificates must also be
@acronym{DER} encoded and suffixed with @file{.crt} or @file{.der}.
@item /var/run/gnupg
@item @value{LOCALRUNDIR}
This directory is only used in the deprecated system daemon mode. It
keeps the socket file for accessing @command{dirmngr} services. The
name of the socket file will be @file{S.dirmngr}. Make sure that this
@ -465,7 +467,7 @@ the socket file and that eligible users may read and write to that
socket.
@item ~/.gnupg/crls.d
@itemx /var/cache/gnupg/crls.d
@itemx @value{LOCALCACHEDIR}/crls.d
The first directory is used to store cached CRLs. The @file{crls.d}
part will be created by dirmngr if it does not exists but you need to
make sure that the upper directory exists. The second directory is

View File

@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename gnupg.info
@include version.texi
@include defs.inc
@settitle Using the GNU Privacy Guard
@c A couple of macros with no effect on texinfo

View File

@ -2,6 +2,7 @@
@c This is part of the GnuPG manual.
@c For copying conditions, see the file gnupg.texi.
@include defs.inc
@node Invoking GPG-AGENT
@chapter Invoking GPG-AGENT
@ -75,8 +76,8 @@ Please make sure that a proper pinentry program has been installed
under the default filename (which is system dependent) or use the
option @option{pinentry-program} to specify the full name of that program.
It is often useful to install a symbolic link from the actual used
pinentry (e.g. @file{/usr/bin/pinentry-gtk}) to the expected
one (e.g. @file{/usr/bin/pinentry}).
pinentry (e.g. @file{@value{BINDIR}/pinentry-gtk}) to the expected
one (e.g. @file{@value{BINDIR}/pinentry}).
@manpause
@noindent
@ -580,7 +581,7 @@ It might even be advisable to change the permissions to read-only so
that this file can't be changed inadvertently.
As a special feature a line @code{include-default} will include a global
list of trusted certificates (e.g. @file{/etc/gnupg/trustlist.txt}).
list of trusted certificates (e.g. @file{@value{SYSCONFDIR}/trustlist.txt}).
This global list is also used if the local list is not available.
It is possible to add further flags after the @code{S} for use by the
@ -647,7 +648,7 @@ implicitly added to this list; i.e. there is no need to list them.
@end table
Note that on larger installations, it is useful to put predefined
files into the directory @file{/etc/skel/.gnupg/} so that newly created
files into the directory @file{@value{SYSCONFSKELDIR}} so that newly created
users start up with a working configuration. For existing users the
a small helper script is provided to create these files (@pxref{addgnupghome}).

View File

@ -3,19 +3,14 @@
@c This is part of the GnuPG manual.
@c For copying conditions, see the file gnupg.texi.
@include defs.inc
@node Invoking GPG
@chapter Invoking GPG
@cindex GPG command options
@cindex command options
@cindex options, GPG command
@c Begin algorithm defaults
@set DEFSYMENCALGO AES128
@c End algorithm defaults
@macro gpgname
gpg2
@end macro
@ -180,7 +175,7 @@ decrypted via a secret key or a passphrase).
@itemx -c
@opindex symmetric
Encrypt with a symmetric cipher using a passphrase. The default
symmetric cipher used is @value{DEFSYMENCALGO}, but may be chosen with the
symmetric cipher used is @value{GPGSYMENCALGO}, but may be chosen with the
@option{--cipher-algo} option. This option may be combined with
@option{--sign} (for a signed and symmetrically encrypted message),
@option{--encrypt} (for a message that may be decrypted via a secret key
@ -1672,7 +1667,7 @@ file name.
@item --dirmngr-program @var{file}
@opindex dirmngr-program
Specify a dirmngr program to be used for keyserver access. The
default value is @file{/usr/sbin/dirmngr}. This is only used as a
default value is @file{@value{BINDIR}/dirmngr}. This is only used as a
fallback when the environment variable @code{DIRMNGR_INFO} is not set or
a running dirmngr cannot be connected.
@ -2152,7 +2147,7 @@ to consider (e.g. @option{--symmetric}).
@item --s2k-cipher-algo @code{name}
@opindex s2k-cipher-algo
Use @code{name} as the cipher algorithm used to protect secret keys.
The default cipher is @value{DEFSYMENCALGO}. This cipher is also used
The default cipher is @value{GPGSYMENCALGO}. This cipher is also used
for symmetric encryption with a passphrase if
@option{--personal-cipher-preferences} and @option{--cipher-algo} is
not given.
@ -2939,8 +2934,8 @@ current home directory (@pxref{option --homedir}).
@c man:.RE
Note that on larger installations, it is useful to put predefined files
into the directory @file{/etc/skel/.gnupg/} so that newly created users
start up with a working configuration.
into the directory @file{@value{SYSCONFSKELDIR}} so that
newly created users start up with a working configuration.
For existing users a small
helper script is provided to create these files (@pxref{addgnupghome}).
@ -2993,10 +2988,10 @@ files; They all live in in the current home directory (@pxref{option
You should backup all files in this directory and take care to keep
this backup closed away.
@item /usr[/local]/share/gnupg/options.skel
@item @value{DATADIR}/options.skel
The skeleton options file.
@item /usr[/local]/lib/gnupg/
@item @value{LIBDIR}/
Default location for extensions.
@end table

View File

@ -2,6 +2,8 @@
@c This is part of the GnuPG manual.
@c For copying conditions, see the file gnupg.texi.
@include defs.inc
@node Invoking GPGSM
@chapter Invoking GPGSM
@cindex GPGSM command options
@ -355,7 +357,7 @@ suite hack and may thus not be used in the file name.
@item --dirmngr-program @var{file}
@opindex dirmngr-program
Specify a dirmngr program to be used for @acronym{CRL} checks. The
default value is @file{/usr/sbin/dirmngr}. This is only used as a
default value is @file{@value{BINDIR}/dirmngr}. This is only used as a
fallback when the environment variable @code{DIRMNGR_INFO} is not set or
a running dirmngr cannot be connected.
@ -819,7 +821,7 @@ mean that the certificate is trusted; in general the certificates listed
in this file need to be listed also in @file{trustlist.txt}.
This is a global file an installed in the data directory
(e.g. @file{/usr/share/gnupg/qualified.txt}). GnuPG installs a suitable
(e.g. @file{@value{DATADIR}/qualified.txt}). GnuPG installs a suitable
file with root certificates as used in Germany. As new Root-CA
certificates may be issued over time, these entries may need to be
updated; new distributions of this software should come with an updated
@ -844,9 +846,9 @@ This is plain text file with a few help entries used with
@command{gpg} and @command{gpgsm}. The standard file has English help
texts; to install localized versions use filenames like @file{help.LL.txt}
with LL denoting the locale. GnuPG comes with a set of predefined help
files in the data directory (e.g. @file{/usr/share/gnupg/help.de.txt})
files in the data directory (e.g. @file{@value{DATADIR}/gnupg/help.de.txt})
and allows overriding of any help item by help files stored in the
system configuration directory (e.g. @file{/etc/gnupg/help.de.txt}).
system configuration directory (e.g. @file{@value{SYSCONFDIR}/help.de.txt}).
For a reference of the help file's syntax, please see the installed
@file{help.txt} file.
@ -857,7 +859,7 @@ This file is a collection of common certificates used to populated a
newly created @file{pubring.kbx}. An administrator may replace this
file with a custom one. The format is a concatenation of PEM encoded
X.509 certificates. This global file is installed in the data directory
(e.g. @file{/usr/share/gnupg/com-certs.pem}).
(e.g. @file{@value{DATADIR}/com-certs.pem}).
@end table

View File

@ -6,6 +6,8 @@
@c This is included by tools.texi.
@c
@include defs.inc
@c Begin GnuPG 1.x specific stuff
@ifset gpgone
@macro gpgvname

View File

@ -29,7 +29,7 @@ configured @command{gnupg} using:
@end example
This is to make sure that system wide configuration files are searched
in the directory @file{/etc/gnupg} and variable data below @file{/var};
in the directory @file{/etc} and variable data below @file{/var};
the default would be to also install them below @file{/usr/local} where
the binaries get installed. If you selected to use the
@option{--prefix=/} you obviously don't need those option as they are

306
doc/mkdefsinc.c Normal file
View File

@ -0,0 +1,306 @@
/* mkdefsinc.c - Tool to create defs.inc
* Copyright (C) 2015 g10 Code GmbH
*
* This file is free software; as a special exception the author gives
* unlimited permission to copy and/or distribute it, with or without
* modifications, as long as this notice is preserved.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/* This tool needs to be build with command line supplied -D options
for the various directory variables. See ../am/cmacros.am. It is
easier to do this in build file than to use fragile make rules and
a template file. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define PGM "mkdefsinc"
/* We include config.h after all include files because the config.h
values are not valid for the build platform but we need some values
nevertheless. */
#include "config.h"
static int verbose;
/* The usual free wrapper. */
static void
xfree (void *a)
{
if (a)
free (a);
}
static char *
xmalloc (size_t n)
{
char *p;
p = malloc (n);
if (!p)
{
fputs (PGM ": out of core\n", stderr);
exit (1);
}
return p;
}
static char *
xstrdup (const char *string)
{
char *p;
p = xmalloc (strlen (string)+1);
strcpy (p, string);
return p;
}
/* Return a malloced string with the last modification date of the
FILES. Returns NULL on error. */
static char *
get_date_from_files (char **files)
{
const char *file;
const char *usedfile = NULL;
struct stat sb;
struct tm *tp;
int errors = 0;
time_t stamp = 0;
char *result;
for (; (file = *files); files++)
{
if (!*file || !strcmp (file, ".") || !strcmp (file, ".."))
continue;
if (stat (file, &sb))
{
fprintf (stderr, PGM ": stat failed for '%s': %s\n",
file, strerror (errno));
errors = 1;
continue;
}
if (sb.st_mtime > stamp)
{
stamp = sb.st_mtime;
usedfile = file;
}
}
if (errors)
exit (1);
if (usedfile)
fprintf (stderr, PGM ": taking date from '%s'\n", usedfile);
tp = gmtime (&stamp);
if (!tp)
return NULL;
result = xmalloc (4+1+2+1+2+1);
snprintf (result, 4+1+2+1+2+1, "%04d-%02d-%02d",
tp->tm_year + 1900, tp->tm_mon+1, tp->tm_mday);
return result;
}
int
main (int argc, char **argv)
{
int last_argc = -1;
char *opt_date = NULL;
int monthoff;
char *p, *pend;
size_t n;
/* Option parsing. */
if (argc)
{
argc--; argv++;
}
while (argc && last_argc != argc )
{
last_argc = argc;
if (!strcmp (*argv, "--"))
{
argc--; argv++;
break;
}
else if (!strcmp (*argv, "--help"))
{
fputs ("Usage: " PGM " [OPTION] [FILES]\n"
"Create defs.inc file.\nOptions:\n"
" -C DIR Change to DIR before doing anything\n"
" --date STRING Take publication date from STRING\n"
" --verbose Enable extra informational output\n"
" --help Display this help and exit\n"
, stdout);
exit (0);
}
else if (!strcmp (*argv, "--verbose"))
{
verbose = 1;
argc--; argv++;
}
else if (!strcmp (*argv, "-C"))
{
argc--; argv++;
if (argc)
{
if (chdir (*argv))
{
fprintf (stderr, PGM ": chdir to '%s' failed: %s\n",
*argv, strerror (errno));
exit (1);
}
argc--; argv++;
}
}
else if (!strcmp (*argv, "--date"))
{
argc--; argv++;
if (argc)
{
opt_date = xstrdup (*argv);
argc--; argv++;
}
}
else if (!strncmp (*argv, "--", 2))
{
fprintf (stderr, PGM ": unknown option '%s'\n", *argv);
exit (1);
}
}
if (opt_date && *opt_date)
{
time_t stamp;
struct tm *tp;
if (*opt_date == '2' && strlen (opt_date) >= 10
&& opt_date[4] == '-' && opt_date[7] == '-')
{
opt_date[10] = 0;
}
else if ((stamp = strtoul (opt_date, NULL, 10)) > 0
&& (tp = gmtime (&stamp)))
{
p = xmalloc (4+1+2+1+2+1);
snprintf (p, 4+1+2+1+2+1, "%04d-%02d-%02d",
tp->tm_year + 1900, tp->tm_mon+1, tp->tm_mday);
xfree (opt_date);
opt_date = p;
}
else
{
fprintf (stderr, PGM ": bad date '%s'\n", opt_date);
exit (1);
}
}
else
{
xfree (opt_date);
opt_date = argc? get_date_from_files (argv) : NULL;
}
if (!opt_date)
{
opt_date = xstrdup ("unknown");
monthoff = 0;
}
else
{
const char *month = "?";
switch (atoi (opt_date+5))
{
case 1: month = "January"; break;
case 2: month = "February"; break;
case 3: month = "March"; break;
case 4: month = "April"; break;
case 5: month = "May"; break;
case 6: month = "June"; break;
case 7: month = "July"; break;
case 8: month = "August"; break;
case 9: month = "September"; break;
case 10: month = "October"; break;
case 11: month = "November"; break;
case 12: month = "December"; break;
}
n = strlen (opt_date) + strlen (month) + 2 + 1;
p = xmalloc (n);
snprintf (p, n, "%d %n%s %d",
atoi (opt_date+8), &monthoff, month, atoi (opt_date));
xfree (opt_date);
opt_date = p;
}
fputs ("@c defs.inc -*- texinfo -*-\n"
"@c Common and build specific constants for the manuals.\n"
"@c This file has been created by " PGM ".\n", stdout);
fputs ("\n@c Directories\n\n", stdout);
fputs ("@set BINDIR " GNUPG_BINDIR "\n"
"@set LIBEXECDIR " GNUPG_LIBEXECDIR "\n"
"@set LIBDIR " GNUPG_LIBDIR "\n"
"@set DATADIR " GNUPG_DATADIR "\n"
"@set SYSCONFDIR " GNUPG_SYSCONFDIR "\n"
"@set LOCALSTATEDIR " GNUPG_LOCALSTATEDIR "\n"
"@set LOCALCACHEDIR " GNUPG_LOCALSTATEDIR
/* */ "/cache/" PACKAGE_NAME "\n"
"@set LOCALRUNDIR " GNUPG_LOCALSTATEDIR
/* */ "/run/" PACKAGE_NAME "\n"
, stdout);
p = xstrdup (GNUPG_SYSCONFDIR);
pend = strrchr (p, '/');
fputs ("@set SYSCONFSKELDIR ", stdout);
if (pend)
{
*pend = 0;
fputs (p, stdout);
}
fputs ("/skel/." PACKAGE_NAME "\n", stdout);
xfree (p);
fputs ("\n@c Version information a la version.texi\n\n", stdout);
printf ("@set UPDATED %s\n", opt_date);
printf ("@set UPDATED-MONTH %s\n", opt_date + monthoff);
printf ("@set EDITION %s\n", PACKAGE_VERSION);
printf ("@set VERSION %s\n", PACKAGE_VERSION);
fputs ("\n@c Algorithm defaults\n\n", stdout);
/* Fixme: Use a config.h macro here: */
fputs ("@set GPGSYMENCALGO AES-128\n", stdout);
fputs ("\n"
"@c Loc" "al Variables:\n"
"@c buffer-read-only: t\n"
"@c End:\n", stdout);
if (ferror (stdout))
{
fprintf (stderr, PGM ": error writing to stdout: %s\n", strerror (errno));
return 1;
}
return 0;
}

View File

@ -18,5 +18,5 @@ empty file name @file{gpgconf.ctl} in the same directory as the tool
directory; or, if @file{gpgconf.exe} has been installed directly below
a directory named @file{bin}, its parent directory. You also need to
make sure that the following directories exist and are writable:
@file{ROOT/home} for the GnuPG home and @file{ROOT/var/cache/gnupg}
@file{ROOT/home} for the GnuPG home and @file{ROOT@value{LOCALCACHEDIR}}
for internal cache files.

View File

@ -2,6 +2,8 @@
@c This is part of the GnuPG manual.
@c For copying conditions, see the file gnupg.texi.
@include defs.inc
@node Invoking SCDAEMON
@chapter Invoking the SCDAEMON
@cindex SCDAEMON command options
@ -469,8 +471,8 @@ make much sense expect for system services, but in this case no
regular user accounts are hosted on the machine.
A client connects to the SC-Daemon by connecting to the socket named
@file{/var/run/scdaemon/socket}, configuration information is read from
@var{/etc/scdaemon.conf}
@file{@value{LOCALRUNDIR}/scdaemon/socket}, configuration information
is read from @var{@value{SYSCONFDIR}/scdaemon.conf}
Each connection acts as one session, SC-Daemon takes care of
synchronizing access to a token between sessions.

View File

@ -2,6 +2,8 @@
@c This is part of the GnuPG manual.
@c For copying conditions, see the file GnuPG.texi.
@include defs.inc
@node Helper Tools
@chapter Helper Tools

View File

@ -1367,7 +1367,7 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
}
if (!incfp)
err ("can't open include file '%s':%s",
err ("can't open include file '%s': %s",
incname, strerror (errno));
else
{