]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use correct compile time values for the NOD and UDR dirs
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 8 Dec 2023 08:38:24 +0000 (09:38 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 8 Dec 2023 08:38:24 +0000 (09:38 +0100)
pdns/recursordist/Makefile.am
pdns/recursordist/settings/generate.py
pdns/recursordist/settings/rust/Makefile.am
pdns/recursordist/settings/table.py

index 8c482ab8fca6a5ced67b97507f1d07ce5ecf4422..36285b95462f6c3a04b22d906a775aa3c88e6d20 100644 (file)
@@ -23,7 +23,7 @@ AM_CXXFLAGS = \
 
 if NOD_ENABLED
 AM_CXXFLAGS += \
-       -DNODCACHEDIR=\"$(nodcachedir)\"
+       -DNODCACHEDIRNOD=\"$(nodcachedir)/nod\" -DNODCACHEDIRUDR=\"$(nodcachedir)/udr\"
 endif
 
 if FSTRM
index c06923e6986cef4b8370d81c632f02e4a3c629ec..e60dea3272a8c7dacc5ead381d15b2416965efea 100644 (file)
@@ -205,6 +205,9 @@ def quote(arg):
     """Return a quoted string"""
     return '"' + arg + '"'
 
+def isEnvVar(name):
+    return name in ('SYSCONFDIR', 'NODCACHEDIRNOD', 'NODCACHEDIRUDR')
+
 def gen_cxx_defineoldsettings(file, entries):
     """Generate C++ code to declare old-style settings"""
     file.write('void pdns::settings::rec::defineOldStyleSettings()\n{\n')
@@ -221,7 +224,7 @@ def gen_cxx_defineoldsettings(file, entries):
         elif entry['type'] == LType.Command:
             file.write(f"  ::arg().setCmd({oldname}, {helptxt});\n")
         else:
-            cxxdef = 'SYSCONFDIR' if entry['default'] == 'SYSCONFDIR' else quote(entry['default'])
+            cxxdef = entry['default'] if isEnvVar(entry['default']) else quote(entry['default'])
             file.write(f"  ::arg().set({oldname}, {helptxt}) = {cxxdef};\n")
     file.write('}\n\n')
 
@@ -415,7 +418,8 @@ def gen_rust_default_functions(entry, name, rust_type):
         return gen_rust_authzonevec_default_functions(name)
     ret = f'// DEFAULT HANDLING for {name}\n'
     ret += f'fn default_value_{name}() -> {rust_type} {{\n'
-    rustdef = 'env!("SYSCONFDIR")' if entry['default'] == 'SYSCONFDIR' else quote(entry['default'])
+    defvalue = entry['default']
+    rustdef = f'env!("{defvalue}")' if isEnvVar(defvalue) else quote(defvalue)
     ret += f"    String::from({rustdef})\n"
     ret += '}\n'
     if rust_type == 'String':
index 1f95a6f77de3911cb3bbd45fdac91e361f750a92..517ca56bac902ff0671e71c9826a54e38b6dc1a7 100644 (file)
@@ -11,7 +11,7 @@ EXTRA_DIST = \
 
 # should actually end up in a target specific dir...
 libsettings.a lib.rs.h: src/bridge.rs src/lib.rs src/helpers.rs Cargo.toml Cargo.lock build.rs
-       SYSCONFDIR=$(sysconfdir) $(CARGO) build --release $(RUST_TARGET)
+       SYSCONFDIR=$(sysconfdir) NODCACHEDIRNOD=$(localstatedir)/nod NODCACHEDIRUDR=$(localstatedir)/udr $(CARGO) build --release $(RUST_TARGET)
        cp target/$(RUSTC_TARGET_ARCH)/release/libsettings.a libsettings.a
        cp target/$(RUSTC_TARGET_ARCH)/cxxbridge/settings/src/lib.rs.h lib.rs.h
        cp target/$(RUSTC_TARGET_ARCH)/cxxbridge/rust/cxx.h cxx.h
index 75158bc495906426cdaf98fa4331fa3f9a3b8f85..2a79096cd47f8b025c195343a481921b58e56ec0 100644 (file)
@@ -1715,7 +1715,7 @@ have no effect unless you remove the existing files.
         'section' : 'nod',
         'oldname' : 'new-domain-history-dir',
         'type' : LType.String,
-        'default' : '/usr/local/var/lib/pdns-recursor/nod',
+        'default' : 'NODCACHEDIRNOD',
         'help' : 'Persist new domain tracking data here to persist between restarts',
         'doc' : '''
 This setting controls which directory is used to store the on-disk
@@ -2358,6 +2358,7 @@ Where to store the control socket and pidfile.
 The default depends on ``LOCALSTATEDIR`` or the ``--with-socketdir`` setting when building (usually ``/var/run`` or ``/run``).
 
 When using :ref:`setting-chroot` the default becomes ``/``.
+Defaults to the ``RUNTIME_DIRECTORY`` environment variable when that variable has a value (e.g. under systemd).
  ''',
     },
     {
@@ -2820,7 +2821,7 @@ have no effect unless you remove the existing files.
         'name' : 'unique_response_history_dir',
         'section' : 'nod',
         'type' : LType.String,
-        'default' : '/usr/local/var/lib/pdns-recursor/udr',
+        'default' : 'NODCACHEDIRUDR',
         'help' : 'Persist unique response tracking data here to persist between restarts',
         'doc' : '''
 This setting controls which directory is used to store the on-disk