]> git.proxmox.com Git - mirror_lxc.git/commitdiff
meson.build: allow explicit distrosysconfdir
authorĐoàn Trần Công Danh <congdanhqx@gmail.com>
Tue, 9 Aug 2022 15:24:09 +0000 (22:24 +0700)
committerĐoàn Trần Công Danh <congdanhqx@gmail.com>
Wed, 10 Aug 2022 00:12:44 +0000 (07:12 +0700)
Allows either:

- Build inside minimal-and-clean chroot with neither
  /etc/sysconfig nor /etc/default available.
- Cross Compile lxc from foreign distro,
  let's say host distro uses /etc/sysconfig and build distro
  uses /etc/default and vice versus.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
meson.build
meson_options.txt

index a145faf069fb25a2920c6a1205c99a15e5d0775c..b27cc8edc7fe9aeb8d861c84bea1edcc3adfe9a8 100644 (file)
@@ -117,14 +117,18 @@ conf.set('SYSCONFDIR', sysconfdir)
 
 # Set sysconfdir
 fs = import('fs')
-if fs.is_dir('/etc/sysconfig')
+distrosysconfdir = get_option('distrosysconfdir')
+if distrosysconfdir != ''
+    distrosysconfdir = join_paths(sysconfdir, distrosysconfdir)
+    conf.set('LXC_DISTRO_SYSCONF', distrosysconfdir)
+elif fs.is_dir('/etc/sysconfig')
     distrosysconfdir = join_paths(sysconfdir, 'sysconfig')
     conf.set('LXC_DISTRO_SYSCONF', distrosysconfdir)
 elif fs.is_dir('/etc/default')
     distrosysconfdir = join_paths(sysconfdir, 'default')
     conf.set('LXC_DISTRO_SYSCONF', distrosysconfdir)
 else
-    distrosysconfdir = ''
+    error('"distrosysconfdir" is not set')
 endif
 
 # Cross-compile on Android.
index c14dacf27fa09bf0cb0c94715dcbececb8aac4c1..de583a086b119e074895df50567f7b3e43fa5263 100644 (file)
@@ -115,3 +115,6 @@ option('thread-safety', type : 'boolean', value : 'true',
 # was --{disable,enable}-memfd-rexec in autotools
 option('memfd-rexec', type : 'boolean', value : 'true',
        description : 'whether to rexec the lxc-attach binary when attaching to a container')
+
+option('distrosysconfdir', type : 'string', value: '',
+       description: 'relative path to sysconfdir for distro default configuration')