From ca2fa90f8e7a9399c7c44781f1a032fe10f98cdc Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Sun, 10 May 2009 23:02:21 +0200 Subject: Manpage generation Provides a set of make rules for generating UNIX manual pages from DocBook 4.5 source as well as sample manpage for sss_useradd. Automatic generation of manual pages during "make" process is tunable with config parameter "--with-manpages". To rebuild the man pages separately, use the "make doc" target. Before building, the manpages are validated using a DTD schema. --- server/Makefile.in | 35 +++++++++- server/conf_macros.m4 | 30 +++++++++ server/configure.ac | 8 +++ server/man/include/param_help.xml | 10 +++ server/man/include/upstream.xml | 4 ++ server/man/sss_useradd.8.xml | 138 ++++++++++++++++++++++++++++++++++++++ server/rules.mk | 18 ++++- sssd.spec | 3 + 8 files changed, 243 insertions(+), 3 deletions(-) create mode 100644 server/man/include/param_help.xml create mode 100644 server/man/include/upstream.xml create mode 100644 server/man/sss_useradd.8.xml diff --git a/server/Makefile.in b/server/Makefile.in index 292b60858..07208df2c 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -17,6 +17,8 @@ srcdir = @srcdir@ builddir = @builddir@ sharedbuilddir = @sharedbuilddir@ INSTALLCMD = @INSTALL@ +XSLTPROC = @XSLTPROC@ +XMLLINT = @XMLLINT@ EXTRA_OBJ=@EXTRA_OBJ@ SSSD_CONF_DIR = @sysconfdir@/sssd SSSD_LIBEXEC_PATH = @libexecdir@/@PACKAGE_NAME@ @@ -25,10 +27,12 @@ LDB_LIBDIR = @libdir@/ldb SSSD_INTROSPECT_PATH=@datarootdir@/@PACKAGE_NAME@/introspect PACKAGE_VERSION = @PACKAGE_VERSION@ srvdir = @srcdir@ +mansrcdir = @srcdir@/man SSSD_PIPE_PATH = @pipepath@ SSSD_DB_PATH = @dbpath@ SSSD_PID_PATH = @pidpath@ SHADOW_UTILS_PATH = @shadow_utils_path@ +SGML_CATALOG_FILES = @SGML_CATALOG_FILES@ TALLOC_LIBS = @TALLOC_LIBS@ TALLOC_CFLAGS = @TALLOC_CFLAGS@ @@ -94,9 +98,14 @@ CFLAGS := -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \ MDLD = @MDLD@ MDLD_FLAGS = @MDLD_FLAGS@ +export SGML_CATALOG_FILES +XMLLINT_FLAGS = --catalogs --postvalid --nonet --xinclude --noout +XSLTPROC_FLAGS = --catalogs --xinclude --nonet + HAVE_INFOPIPE = @HAVE_INFOPIPE@ HAVE_POLICYKIT = @HAVE_POLICYKIT@ HAVE_TESTS = @HAVE_TESTS@ +HAVE_MANPAGES = @HAVE_MANPAGES@ MEMBEROF_SOBASE=memberof.$(SHLIBEXT) MEMBEROF_SONAME=$(MEMBEROF_SOBASE).0 @@ -122,6 +131,13 @@ headers = DBUS_SYSBUS_POLICY_DIR = @sysconfdir@/dbus-1/system.d SSSD_CONF_FILE = etc/sssd.conf +DOCBOOK_XSLT = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl +MANPAGES = man/sss_useradd.8 + +ifneq (x$(HAVE_MANPAGES), x) + GENDOC = $(MANPAGES) +endif + LIBEXECBINS = sbin/sssd_nss sbin/sssd_dp sbin/sssd_be sbin/sssd_pam ifneq (x$(HAVE_INFOPIPE), x) LIBEXECBINS += sbin/sssd_info @@ -146,7 +162,7 @@ SOBASELIBS = lib/$(PROXY_BE_SOBASE) lib/$(MEMBEROF_SOBASE) lib/$(LDAP_BE_SOBASE) DIRS = sbin lib -all: showflags dirs $(OBJS) $(BINS) $(SOBASELIBS) +all: showflags dirs $(OBJS) $(BINS) $(SOBASELIBS) $(GENDOC) shared-build: all @@ -161,6 +177,7 @@ clean:: testclean rm -f *.o */*.o */*/*.o rm -f $(BINS) rm -f $(SOBASELIBS) $(SONAMELIBS) $(SOLIBS) $(LDBLIBS) + rm -f $(MANPAGES) distclean:: clean rm -rf $(DIRS) @@ -173,7 +190,7 @@ realdistclean:: distclean testclean:: rm -f $(TESTS) $(TESTS_DATA) -install:: all installdirs installheaders installlibs installbin installsupport +install:: all installdirs installheaders installlibs installbin installsupport installdoc ${INSTALLCMD} -d $(DESTDIR)$(sbindir) ${INSTALLCMD} -m 755 sbin/sssd $(DESTDIR)$(sbindir) ${INSTALLCMD} -m 755 $(TOOLSBINS) $(DESTDIR)$(sbindir) @@ -186,6 +203,7 @@ installdirs:: $(DESTDIR)$(libdir) \ $(DESTDIR)$(sbindir) \ $(DESTDIR)$(initdir) \ + $(DESTDIR)$(mandir) \ $(DESTDIR)$(SSSD_LIBDIR) \ $(DESTDIR)$(LDB_LIBDIR) \ $(DESTDIR)$(DBUS_SYSBUS_POLICY_DIR) \ @@ -220,3 +238,16 @@ ifneq (x$(HAVE_INFOPIPE), x) cp $(DBUS_SYSBUS_POLICIES) $(DESTDIR)$(DBUS_SYSBUS_POLICY_DIR) cp $(INFP_INTROSPECT_XML) $(DESTDIR)$(SSSD_INTROSPECT_PATH)/infopipe endif + +doc:: $(if $(HAVE_MANPAGES),$(MANPAGES), \ + $(info Please use configure option --with-manpages to enable)) + +installdoc:: installdirs +ifneq (x$(HAVE_MANPAGES), x) + for mp in $(MANPAGES); do \ + FNAME=`basename $${mp}`; \ + SECTION=`echo $${mp} | grep -o .$$`; \ + SECTION_DIR=man$${SECTION}; \ + $(INSTALLCMD) -D -m 644 $${mp} $(DESTDIR)$(mandir)/$${SECTION_DIR}/$${FNAME}; \ + done ; +endif diff --git a/server/conf_macros.m4 b/server/conf_macros.m4 index 27006e6dd..d93450793 100644 --- a/server/conf_macros.m4 +++ b/server/conf_macros.m4 @@ -143,3 +143,33 @@ AC_DEFUN(WITH_SHADOW_UTILS_PATH, fi AC_SUBST(shadow_utils_path) ]) + +AC_DEFUN(WITH_MANPAGES, + [ AC_ARG_WITH([manpages], + [AC_HELP_STRING([--with-manpages], + [Whether to regenerate man pages from DocBook sources [yes]] + ) + ], + [], + with_manpages=yes + ) + if test x"$with_manpages" == xyes; then + HAVE_MANPAGES=1 + AC_SUBST(HAVE_MANPAGES) + fi + ]) + +AC_DEFUN([WITH_XML_CATALOG], + [ AC_ARG_WITH([xml-catalog-path], + [AC_HELP_STRING([--with-xml-catalog-path=PATH], + [Where to look for XML catalog [/etc/xml/catalog]] + ) + ] + ) + SGML_CATALOG_FILES="/etc/xml/catalog" + if test x"$with_xml_catalog_path" != x; then + SGML_CATALOG_FILES="$with_xml_catalog_path" + fi + AC_SUBST([SGML_CATALOG_FILES]) + ]) + diff --git a/server/configure.ac b/server/configure.ac index 79eb7305c..a6a611a19 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -40,6 +40,8 @@ WITH_POLICYKIT WITH_TESTS WITH_INIT_DIR WITH_SHADOW_UTILS_PATH +WITH_MANPAGES +WITH_XML_CATALOG m4_include(pkg.m4) m4_include(libpopt.m4) @@ -64,6 +66,12 @@ if test x$HAVE_TESTS != x; then fi PKG_CHECK_MODULES([NSS],[nss]) +if test x$HAVE_MANPAGES != x; then + AC_CHECK_FILE($SGML_CATALOG_FILES, [], [AC_MSG_ERROR([could not find XML catalog])]) + AC_PATH_PROG([XSLTPROC], [xsltproc]) + AC_PATH_PROG([XMLLINT], [xmllint]) +fi + AC_SUBST(TESTS) AC_SUBST(EXTRA_OBJ) diff --git a/server/man/include/param_help.xml b/server/man/include/param_help.xml new file mode 100644 index 000000000..a2478bf28 --- /dev/null +++ b/server/man/include/param_help.xml @@ -0,0 +1,10 @@ + + + , + + + + Display help message and exit. + + + diff --git a/server/man/include/upstream.xml b/server/man/include/upstream.xml new file mode 100644 index 000000000..b6f633ccd --- /dev/null +++ b/server/man/include/upstream.xml @@ -0,0 +1,4 @@ + + SSSD + The SSSD upstream - http://fedorahosted.org/sssd + diff --git a/server/man/sss_useradd.8.xml b/server/man/sss_useradd.8.xml new file mode 100644 index 000000000..98bd72724 --- /dev/null +++ b/server/man/sss_useradd.8.xml @@ -0,0 +1,138 @@ + + + +SSSD Manual pages + + + + + sss_useradd + 8 + + + + sss_useradd + create a new user + + + + + sss_useradd + + options + + LOGIN + + + + + DESCRIPTION + + sss_useradd command creates a new user account using + the values specified on the command line plus the default values from + the system. + + + + + OPTIONS + + + + , + UID + + + + Set the UID of the user to the value of UID. + If not given, it is chosen automatically. + + + + + + , + GID + + + + Set the GID or group membership of the user to the value + of GID. If not given, it is + chosen automatically. + + + + + + , + COMMENT + + + + Any text string describing the user. Often used as + the field for the user's full name. + + + + + + , + HOME_DIR + + + + The home directory of the user account. + The default is to append the LOGIN name + to /home and use that as the login directory name. + + + + + + , + SHELL + + + + The user's login shell. The default is currently /bin/bash. + + + + + + , + GROUPS + + + + A list of existing groups this user is also a member of. + + + + + + + + + SEE ALSO + + + groupadd8 + , + + groupdel8 + , + + groupmod8 + , + + userdel8 + , + + usermod8 + . + + + + diff --git a/server/rules.mk b/server/rules.mk index 8ef3676ac..69f3c45a3 100644 --- a/server/rules.mk +++ b/server/rules.mk @@ -4,7 +4,7 @@ etags: ctags: ctags `find $(srcdir) -name "*.[ch]"` -.SUFFIXES: .c .o +.SUFFIXES: .c .o .xml .1.xml .3.xml .5.xml .8.xml .1 .3 .5 .8 .c.o: @echo Compiling $*.c @@ -16,6 +16,22 @@ ctags: @mkdir -p `dirname $@` @$(CC) -fPIC $(CFLAGS) -c $< -o $@ +.1.xml.1: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + +.3.xml.3: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + +.5.xml.5: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + +.8.xml.8: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + showflags:: @echo 'server will be compiled with flags:' @echo ' CFLAGS = $(CFLAGS)' diff --git a/sssd.spec b/sssd.spec index 2b374c290..20d939b75 100644 --- a/sssd.spec +++ b/sssd.spec @@ -39,6 +39,8 @@ BuildRequires: pam-devel BuildRequires: nss-devel BuildRequires: nspr-devel BuildRequires: pcre-devel +BuildRequires: libxslt +BuildRequires: libxml2 %description Provides a set of daemons to manage access to remote directories and @@ -110,6 +112,7 @@ rm -rf $RPM_BUILD_ROOT /%{_lib}/libnss_sss.so /%{_lib}/libnss_sss.so.2 /%{_lib}/security/pam_sss.so +%{_mandir}/man8/* %post /sbin/ldconfig -- cgit