]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: add install target to meson
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 12 Feb 2025 15:03:46 +0000 (16:03 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 14 Feb 2025 09:49:31 +0000 (10:49 +0100)
And always generate default config in YAML format

pdns/recursordist/Makefile.am
pdns/recursordist/meson.build
pdns/recursordist/rec-main.cc

index 32f27c7366d12763d25cbb1814f3e550534b1aee..90070b3f1e79a649bd5248f6448cd7d97f40ae1f 100644 (file)
@@ -572,7 +572,7 @@ pubsuffix.cc: $(srcdir)/effective_tld_names.dat
 sysconf_DATA = recursor.yml-dist
 
 recursor.yml-dist: pdns_recursor
-       dir=$$(mktemp -d) && touch "$$dir/recursor.yml" && ./pdns_recursor --config-dir="$$dir" --config=default 2> /dev/null > $@ && rm "$$dir/recursor.yml" && rmdir "$$dir"
+       ./pdns_recursor --config-dir="$$dir" --config=default 2> /dev/null > $@
 
 ## Manpages
 MANPAGES=pdns_recursor.1 \
index c3a877a384ea119b96546021a91eb4ed45f62193..bb999c3f2cdf71b2bc47562cf5e5299243010ac4 100644 (file)
@@ -432,6 +432,8 @@ tools = {
       librec_signers_sodium,
       dep_pubsuffix,
     ],
+    'install': true,
+    'install_dir': get_option('sbindir'),
   },
   'rec_control': {
     'main': src_dir / 'rec_control.cc',
@@ -441,6 +443,7 @@ tools = {
       dep_recrust,
       dep_rust_recrust,
     ],
+    'install': true,
   },
 }
 
@@ -541,6 +544,8 @@ foreach tool, info: tools
   export_dynamic = 'export-dynamic' in info ? info['export-dynamic'] : false
   files_extra = 'files-extra' in info ? info['files-extra'] : []
   deps_extra = 'deps-extra' in info ? info['deps-extra'] : []
+  install = 'install' in info ? info['install'] : false
+  install_dir = 'install_dir' in info ? info['install_dir'] : get_option('bindir')
 
   set_variable(
     var_name,
@@ -554,6 +559,8 @@ foreach tool, info: tools
         librec_common,
         deps_extra,
       ],
+      install: install,
+      install_dir: install_dir,
     )
   )
 
@@ -605,6 +612,10 @@ if python.found()
 endif
 
 if dep_systemd.found()
+  systemd_system_unit_dir = dep_systemd_prog.get_variable(
+    'systemdsystemunitdir',
+  )
+
   systemd_service_conf = configuration_data()
   systemd_service_conf.set('BinDir', get_option('prefix') / get_option('bindir'))
   systemd_service_conf.set('StaticBinDir', get_option('prefix') / get_option('sbindir'))
@@ -684,6 +695,8 @@ if dep_systemd.found()
     input: 'pdns-recursor.service.meson.in',
     output: 'pdns-recursor.service',
     configuration: rec_service_conf_general,
+    install: true,
+    install_dir: systemd_system_unit_dir,
   )
 
   rec_service_conf_instance = configuration_data()
@@ -699,5 +712,18 @@ if dep_systemd.found()
     input: 'pdns-recursor.service.meson.in',
     output: 'pdns-recursor@.service',
     configuration: rec_service_conf_instance,
+    install: true,
+    install_dir: systemd_system_unit_dir,
   )
 endif
+
+
+dep_conf_distfile = custom_target(
+  'gen-conf-distfile',
+  command: [pdns_recursor, '--config=default'],
+  output: 'recursor.yml-dist',
+  capture: true,
+  install: true,
+  install_dir:  get_option('sysconfdir'),
+)
+
index 3fae0825f6ae39677a4cdd0565e55230429fd978..0666317678b388eebf8c2f514d5e2da7427e4e52 100644 (file)
@@ -3014,7 +3014,8 @@ static pair<int, bool> doConfig(Logr::log_t startupLog, const string& configname
       }
     }
     else if (config == "default" || config.empty()) {
-      cout << ::arg().configstring(false, true);
+      auto yaml = pdns::settings::rec::defaultsToYaml();
+      cout << yaml << endl;
     }
     else if (config == "diff") {
       if (!::arg().laxFile(configname)) {
@@ -3249,7 +3250,7 @@ int main(int argc, char** argv)
     }
     else {
       configname += ".conf";
-      startupLog->info(Logr::Warning, "Trying to read YAML from .yml or .conf failed, failing back to old-style config read", "configname", Logging::Loggable(configname));
+      startupLog->info(Logr::Warning, "Trying to read YAML from .yml or .conf failed, falling back to old-style config read", "configname", Logging::Loggable(configname));
       bool mustExit = false;
       std::tie(ret, mustExit) = doConfig(startupLog, configname, argc, argv);
       if (ret != 0 || mustExit) {