[fedfs-utils] [PATCH] configure.ac: Add a --with-fedfsuser and --with-statedir options

Chuck Lever chuck.lever at oracle.com
Tue Sep 20 09:11:34 PDT 2011


Allow distributions to set the name of the user ID and group ID used
for FedFS system operations and to set the directory used to contain
TLS certs and the NSDB parameter database.

An install hook to update man pages with the directory pathname is
also introduced.  I noticed that subdirectory pathname for storing
certs is incorrect in the man pages; fixed.

Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
---

Proposed replacement for patch 8/8 of yesterday's series.  I've done
some testing, but someone who can run rpmlint and an install test
should have a look.

 configure.ac         |   18 ++++++++++++++++++
 doc/man/Makefile.am  |   10 ++++++++++
 doc/man/nsdbparams.8 |    4 ++--
 doc/man/rpc.fedfsd.8 |    4 ++--
 src/include/fedfs.h  |   15 ---------------
 5 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/configure.ac b/configure.ac
index 33f94b1..3647dba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,24 @@ AC_CONFIG_MACRO_DIR([m4])
 LT_INIT
 AM_INIT_AUTOMAKE
 
+# configure command line options
+AC_ARG_WITH([fedfsuser],
+	[AC_HELP_STRING([--with-fedfsuser=name],
+		[User name to use when dropping privileges @<:@default=fedfs@:>@])],
+	fedfsuser=$withval,
+	fedfsuser=fedfs)
+	AC_SUBST(fedfsuser)
+	AC_DEFINE_UNQUOTED([FEDFS_USER], ["$fedfsuser"],
+		[Define to the user name to use when dropping privileges.])
+AC_ARG_WITH([statedir],
+	[AC_HELP_STRING([--with-statedir=pathname],
+		[Default pathname of directory where fedfsd maintains persistent state @<:@default=/var/lib/fedfs@:>@])],
+	statedir=$withval,
+	statedir=/var/lib/fedfs)
+	AC_SUBST(statedir)
+	AC_DEFINE_UNQUOTED([FEDFS_DEFAULT_STATEDIR], ["$statedir"],
+		[Define to the default pathname of the directory where fedfsd maintains persistent state.])
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index e8f2d8e..a99ad4a 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -41,3 +41,13 @@ dist_man8_MANS		= rpc.fedfsd.8 mount.fedfs.8 fedfs-map-nfs4.8 \
 			  nsdbparams.8 $(FEDFS_CLIENT_CMDS) $(NSDB_CLIENT_CMDS)
 CLEANFILES		= cscope.in.out cscope.out cscope.po.out
 DISTCLEANFILES		= Makefile.in
+
+install-data-hook:
+	(cd $(DESTDIR)$(mandir)/man7 && \
+	  for p in $(dist_man7_MANS); do \
+	    $(SED) -i 's,[@]statedir@,$(statedir),' $$p ;\
+	  done)
+	(cd $(DESTDIR)$(mandir)/man8 && \
+	  for p in $(dist_man8_MANS); do \
+	    $(SED) -i 's,[@]statedir@,$(statedir),' $$p ;\
+	  done)
diff --git a/doc/man/nsdbparams.8 b/doc/man/nsdbparams.8
index cd8abe3..c99aa18 100644
--- a/doc/man/nsdbparams.8
+++ b/doc/man/nsdbparams.8
@@ -243,10 +243,10 @@ you might use:
 sudo nsdbparams update --nsdbparams=nsdb.example.net --sectype FEDFS_SEC_NONE
 .SH FILES
 .TP
-.I /var/lib/fedfs/nsdbparam.sqlite3
+.I @statedir@/nsdbparam.sqlite3
 database of NSDB connection parameters
 .TP
-.I /var/lib/fedfs/tls/certs
+.I @statedir@/nsdbcerts
 local directory that stores X.509 certificates for NSDBs
 .SH "SEE ALSO"
 .BR fedfs (7),
diff --git a/doc/man/rpc.fedfsd.8 b/doc/man/rpc.fedfsd.8
index aa6e895..1840545 100644
--- a/doc/man/rpc.fedfsd.8
+++ b/doc/man/rpc.fedfsd.8
@@ -131,10 +131,10 @@ attempts to create such a database.
 If it cannot, the daemon fails to start.
 .SH FILES
 .TP
-.I /var/lib/fedfs/nsdbparam.sqlite3
+.I @statedir@/nsdbparam.sqlite3
 database of NSDB connection parameters
 .TP
-.I /var/lib/fedfs/tls/certs
+.I @statedir@/nsdbcerts
 local directory that stores X.509 certificates for NSDBs
 .SH "SEE ALSO"
 .BR fedfs (7),
diff --git a/src/include/fedfs.h b/src/include/fedfs.h
index 483dda4..9c4670a 100644
--- a/src/include/fedfs.h
+++ b/src/include/fedfs.h
@@ -47,21 +47,6 @@
 #define FEDFS_DATABASE_FILE		"nsdbparam.sqlite3"
 
 /**
- * Default pathname of directory where fedfsd maintains persistent state
- */
-#ifndef FEDFS_DEFAULT_STATEDIR
-#define FEDFS_DEFAULT_STATEDIR		"/var/lib/fedfs"
-#endif	/* FEDFS_DEFAULT_STATEDIR */
-
-/**
- * User name to use when dropping privileges.  This user is
- * typically the owner of default state directory.
- */
-#ifndef FEDFS_USER
-#define FEDFS_USER	"fedfs"
-#endif	/* FEDFS_USER */
-
-/**
  * Initial number of seconds to wait after receiving FEDFS_ERR_DELAY
  */
 #define FEDFS_DELAY_MIN_SECS	2




More information about the fedfs-utils-devel mailing list