]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-build: Add support for CTDB_{LOCKDIR,PIDDIR,SOCKETDIR}
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 6 Jul 2026 08:18:51 +0000 (18:18 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 13 Jul 2026 12:53:22 +0000 (12:53 +0000)
That is, introduce new defines:

* CTDB_LOCKDIR
* CTDB_PIDDIR
* CTDB_SOCKETDIR

The new defines are currently unused.  However, the directories are
created at installation time.

This is the first step in addressing the problem where /var/run/ctdb/
can't be separately configured to be outside LOCALSTATEDIR.
e.g. /run/ctdb/.

This has become a problem when unpacking Samba installation tarballs.
Some versions of tar (e.g. 1.35-11.el10) don't handle unpacking across
cross-filesystem symlinks (such as /var/run -> ../run) due to
extensive use of openat(2).  This could be a bug in tar, but we might
as well use this as an opportunity make CTDB's installation paths more
flexible.

The change recognises that CTDB is part of Samba, following its
build-time configuration for these items.  So, the new defines point
to ctdb/ subdirectories under Samba's LOCKDIR, PIDDIR and SOCKET_DIR,
respectively.

For the standalone build, the required variables are not available, so
add some backward compatibility.  This means that using CTDB with
Samba requires a combined build.  This is of little consequences
because the standalone build is probably only used for developer
testing.  Replacing the backward compatibility hack by plumbing
dynconfig into CTDB is an exercise for another time - I tried it and
it didn't seem straightforward.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
ctdb/wscript

index 53a2cf7ae11cbcc398dfc405188d0a9831d6f118..d8db80b49828a75f6da0c92d26a9e3c3f4a3c7e2 100644 (file)
@@ -289,11 +289,20 @@ def configure(conf):
             Logs.error("Missing librados for Ceph recovery lock support")
             sys.exit(1)
 
+    if conf.env.standalone_ctdb:
+        t = os.path.join(conf.env.LOCALSTATEDIR, 'run')
+        conf.env.LOCKDIR = t
+        conf.env.PIDDIR = t
+        conf.env.SOCKET_DIR = t
+
     conf.env.CTDB_BINDIR = os.path.join(conf.env.EXEC_PREFIX, 'bin')
     conf.env.CTDB_DATADIR = os.path.join(conf.env.EXEC_PREFIX, 'share/ctdb')
     conf.env.CTDB_ETCDIR = os.path.join(conf.env.SYSCONFDIR, 'ctdb')
     conf.env.CTDB_HELPER_BINDIR = os.path.join(conf.env.LIBEXECDIR, 'ctdb')
+    conf.env.CTDB_LOCKDIR = os.path.join(conf.env.LOCKDIR, 'ctdb')
+    conf.env.CTDB_PIDDIR = os.path.join(conf.env.PIDDIR, 'ctdb')
     conf.env.CTDB_RUNDIR = os.path.join(conf.env.LOCALSTATEDIR, 'run/ctdb')
+    conf.env.CTDB_SOCKETDIR = os.path.join(conf.env.SOCKET_DIR, 'ctdb')
     conf.env.CTDB_VARDIR = os.path.join(conf.env.LOCALSTATEDIR, 'lib/ctdb')
 
     if Options.options.ctdb_logdir:
@@ -313,7 +322,10 @@ def configure(conf):
         "CTDB_DATADIR":       conf.env.CTDB_DATADIR,
         "CTDB_ETCDIR":        conf.env.CTDB_ETCDIR,
         "CTDB_HELPER_BINDIR": conf.env.CTDB_HELPER_BINDIR,
+        "CTDB_LOCKDIR":       conf.env.CTDB_LOCKDIR,
+        "CTDB_PIDDIR":        conf.env.CTDB_PIDDIR,
         "CTDB_RUNDIR":        conf.env.CTDB_RUNDIR,
+        "CTDB_SOCKETDIR":     conf.env.CTDB_SOCKETDIR,
         "CTDB_VARDIR":        conf.env.CTDB_VARDIR,
         "LOGDIR":             conf.env.CTDB_LOGDIR,
     }
@@ -925,8 +937,11 @@ def build(bld):
                       'config/notification.README',
                       destname='README')
 
+    bld.INSTALL_DIR(bld.env.CTDB_LOCKDIR)
     bld.INSTALL_DIR(bld.env.CTDB_LOGDIR)
+    bld.INSTALL_DIR(bld.env.CTDB_PIDDIR)
     bld.INSTALL_DIR(bld.env.CTDB_RUNDIR)
+    bld.INSTALL_DIR(bld.env.CTDB_SOCKETDIR)
     bld.INSTALL_DIR(bld.env.CTDB_VARDIR)
 
     for d in ['volatile', 'persistent', 'state']: