[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [RFC/PATCH] First batch to clean prefixes and paths



After David comments I went around and checked the entire configure and
dependencies again.

On an Ubuntu machine (please let me know if it is substantially different on
other distro's) all the external libraries we depend on are in /usr/.. and given
that /usr can be on its own partition and not mounted by the time we are
starting the cluster. This would clearly lead to a failure.

init scripts as provided in tree do not understand the concept of prefix and
sbindir. An example from cman init.d:

start_ccsd()
	[snip]
	errmsg=$(/sbin/ccsd $CCSD_OPTS 2>&1)
	[snip]

start_cman()
	[snip]
	/usr/sbin/cman_tool status &> /dev/null
	[snip]

this clearly is a mess for who packages the RPMs.

missing from the configure is the concept of ${prefix}/etc. we hardcode
/etc/cluster/cluster.conf. It is perfectly legal to have /usr/local/etc in the
FHS (http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHIERARCHY)

both openais and cluster use the libexec dir. This is not mentioned anywhere in
either FHS2.2 or FHS2.3. Should we perhaps clean it up to be /usr/lib/openais/
(http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLIBLIBRARIESFORPROGRAMMINGANDPA)

cman_tool uses SBINDIR to access aisexec and this is somewhat bad. I should have
spotted this before.

So in this first patch (that seems the most urgent one):

- Make prefix default to /usr

- Clean up all prefix use around configure (this will make alternate prefixes
like /usr/local works properly).

- Add a specific --aisexecbin option that is passed to cman_tool build. This
change defaults to /usr/sbin/aisexec (default aisexec install path) but also
allow local override if you have aisexec installed in different paths.

3 NOTES:

- the cman_tool change has not been tested in production. It builds and shows
that the path is passed properly. Patrick?

- all people that use a prefix=/ will need to make sure to use some extra
configure options to respect FHS (for example to install man pages in
/usr/share/man rather than /share/man..).

- If this patch goes in CVS, you need to make sure to re-run ./configure.

Please apply or ACK.

Fabio

PS This seems to be kind of urgent since it's generating frustrations around.

-- 
I'm going to make him an offer he can't refuse.
? make/defines.mk
Index: configure
===================================================================
RCS file: /cvs/cluster/cluster/configure,v
retrieving revision 1.29
diff -u -r1.29 configure
--- configure	6 Sep 2007 16:26:47 -0000	1.29
+++ configure	7 Sep 2007 05:13:05 -0000
@@ -49,6 +49,7 @@
 	readlinelibdir => \$readlinelibdir,
 	openaisincdir => \$openaisincdir,
 	openaislibdir => \$openaislibdir,
+	aisexecbin => \$aisexecbin,
 	virtincdir => \$virtincdir,
 	virtlibdir => \$virtlibdir,
 	nssincdir => \$nssincdir,
@@ -94,6 +95,7 @@
 		    'readlinelibdir=s',
 		    'openaisincdir=s',
 		    'openaislibdir=s',
+		    'aisexecbin=s',
 		    'virtincdir=s',
 		    'virtlibdir=s',
 		    'nssincdir=s',
@@ -124,12 +126,12 @@
   print "Usage: $_ [flags]\n";
   print "--help\t\tPrints this usage information\n\n";
   print "install flags:\n";
-  print "--prefix=\tthe base directory to install into.  (Default: /)\n";
+  print "--prefix=\tthe base directory to install into.  (Default: /usr)\n";
   print "--sbindir=\tthe base directory for system binaries.  (Default: {prefix}/sbin)\n";
-  print "--libdir=\tthe base directory for libraries.  (Default: {prefix}/usr/lib)\n";
-  print "--libexecdir=\tthe base directory for executable components.  (Default: {prefix}/usr/libexec)\n";
-  print "--sharedir=\tthe base directory for misc cluster files.  (Default: {prefix}/usr/share/cluster)\n";
-  print "--mandir=\tthe base directory for man pages.  (Default:  {prefix}/usr/share/man)\n";
+  print "--libdir=\tthe base directory for libraries.  (Default: {prefix}/lib)\n";
+  print "--libexecdir=\tthe base directory for executable components.  (Default: {prefix}/libexec)\n";
+  print "--sharedir=\tthe base directory for misc cluster files.  (Default: {prefix}/share/cluster)\n";
+  print "--mandir=\tthe base directory for man pages.  (Default: {prefix}/share/man)\n";
   print "--module_dir=\tthe base directory for kernel modules.  (Default:  /lib/modules/`uname -r`/kernel\n";
   print "\nbuild flags:\n";
   print "--cc=\t\tcompiler to use.  (Default: gcc)\n";
@@ -139,7 +141,7 @@
   print "--ldflags=\toverride default LDFLAGS settings.  (Default: none)\n";
   print "--extraldflags=\tadd extra linking options to default LDFLAGS settings.  (Default: none)\n";
   print "--kernel_src=\tthe directory containing the kernel source you wish to\n\t\tcompile against. (Default: /lib/modules/`uname -r`/build)\n";
-  print "--incdir=\tthe base directory for include files.  (Default: {prefix}/usr/include)\n";
+  print "--incdir=\tthe base directory for include files.  (Default: {prefix}/include)\n";
   print "--ccsincdir=\tthe base directory for ccs include files.  (Default: ./ccs/lib)\n";
   print "--ccslibdir=\tthe base directory for ccs libraries.  (Default: ./ccs/lib)\n";
   print "--cmanincdir=\tthe base directory for cman include files.  (Default: ./cman/lib)\n";
@@ -154,6 +156,7 @@
   print "--readlinelibdir=\tthe base directory for readline libraries.  (Default: {libdir})\n";
   print "--openaisincdir=\tthe base directory for openais include files.  (Default: {incdir})\n";
   print "--openaislibdir=\tthe base directory for openais libraries.  (Default: {libdir}/openais)\n";
+  print "--aisexecbin=\tlocation of aisexec executable file.  (Default: /usr/sbin/aisexec)\n";
   print "--nssincdir=\tthe base directory for libnss include files.  (Default: {incdir}/nss3)\n";
   print "--nsslibdir=\tthe base directory for libnss libraries.  (Default: {libdir})\n";
   print "--nsprincdir=\tthe base directory for libnspr include files.  (Default: {incdir}/nspr4)\n";
@@ -189,6 +192,9 @@
 if ($extraldflags) {
   $ldflags="${ldflags} ${extraldflags}";
 }
+if (!$prefix) {
+  $prefix="/usr";
+}
 if (!$kernel_src) {
   $kernel_src="/lib/modules/`uname -r`/build";
 }
@@ -202,10 +208,10 @@
   $gnbdkincdir="${pwd}/gnbd-kernel/src";
 }
 if (!$incdir) {
-  $incdir="${prefix}/usr/include";
+  $incdir="${prefix}/include";
 }
 if (!$libdir) {
-  $libdir="${prefix}/usr/lib";
+  $libdir="${prefix}/lib";
 }
 if (!$ccsincdir) {
   $ccsincdir="${pwd}/ccs/lib";
@@ -249,6 +255,9 @@
 if (!$openaislibdir) {
   $openaislibdir="${libdir}/openais";
 }
+if (!$aisexecbin) {
+  $aisexecbin="/usr/sbin/aisexec";
+}
 if (!$nssincdir) {
   $nssincdir="${incdir}/nss3";
 }
@@ -274,16 +283,16 @@
   $xenlibdir="${libdir}";
 }
 if (!$libexecdir) {
-  $libexecdir="${prefix}/usr/libexec";
+  $libexecdir="${prefix}/libexec";
 }
 if (!$mandir) {
-  $mandir="${prefix}/usr/share/man";
+  $mandir="${prefix}/share/man";
 }
 if (!$sbindir) {
   $sbindir="${prefix}/sbin";
 }
 if (!$sharedir) {
-  $sharedir="${prefix}/usr/share/cluster";
+  $sharedir="${prefix}/share/cluster";
 }
 
 @args = "find fence/agents -mindepth 2 -maxdepth 2 -name Makefile -printf '%h'";
@@ -337,6 +346,7 @@
   $_ =~ s/\ NCURSESLIBDIR\@/$ncurseslibdir/;
   $_ =~ s/\ OPENAISINCDIR\@/$openaisincdir/;
   $_ =~ s/\ OPENAISLIBDIR\@/$openaislibdir/;
+  $_ =~ s/\ AISEXECBIN\@/$aisexecbin/;
   $_ =~ s/\ XENINCDIR\@/$xenincdir/;
   $_ =~ s/\ XENLIBDIR\@/$xenlibdir/;
   $_ =~ s/\ NSSINCDIR\@/$nssincdir/;
Index: cman/cman_tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/cman_tool/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- cman/cman_tool/Makefile	28 Aug 2007 04:35:39 -0000	1.24
+++ cman/cman_tool/Makefile	7 Sep 2007 05:13:05 -0000
@@ -17,7 +17,7 @@
 OBJS=	main.o \
 	join.o
 
-CFLAGS += -DSBINDIR=\"${sbindir}\"
+CFLAGS += -DAISEXECBIN=\"${aisexecbin}\"
 CFLAGS += -I${ccsincdir} -I${cmanincdir}
 CFLAGS += -I${incdir}
 
Index: cman/cman_tool/join.c
===================================================================
RCS file: /cvs/cluster/cluster/cman/cman_tool/join.c,v
retrieving revision 1.50
diff -u -r1.50 join.c
--- cman/cman_tool/join.c	19 Feb 2007 13:10:24 -0000	1.50
+++ cman/cman_tool/join.c	7 Sep 2007 05:13:05 -0000
@@ -137,11 +137,10 @@
 	case 0: // child
 		close(p[0]);
 		be_daemon(!comline->verbose);
-		chdir(SBINDIR);
-		execve("./aisexec", argv, envp);
+		execve(AISEXECBIN, argv, envp);
 
 		// exec failed - tell the parent process */
-		sprintf(scratch, "execve of " SBINDIR "/aisexec failed: %s", strerror(errno));
+		sprintf(scratch, "execve of " AISEXECBIN " failed: %s", strerror(errno));
 		write(p[1], scratch, strlen(scratch));
 		exit(1);
 		break;
Index: make/defines.mk.input
===================================================================
RCS file: /cvs/cluster/cluster/make/defines.mk.input,v
retrieving revision 1.2
diff -u -r1.2 defines.mk.input
--- make/defines.mk.input	2 May 2007 12:39:35 -0000	1.2
+++ make/defines.mk.input	7 Sep 2007 05:13:06 -0000
@@ -55,6 +55,7 @@
 nsprlibdir ?= @NSPRLIBDIR@
 openaisincdir ?= @OPENAISINCDIR@
 openaislibdir ?= @OPENAISLIBDIR@
+aisexecbin ?= @AISEXECBIN@
 xenincdir ?= @XENINCDIR@
 xenlibdir ?= @XENLIBDIR@
 virtincdir ?= @VIRTINCDIR@

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]