]> git.ipfire.org Git - thirdparty/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)
committerAleksa Sarai <cyphar@cyphar.com>
Fri, 28 Oct 2022 03:33:19 +0000 (14:33 +1100)
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 5d1bb36c12d239914319a2a8aa60cdb8cb54e7b7..95bf22372891344fa8bde46727bf172c7f18cb35 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 801ba4175c1d05ad1d32c8756a794a1a3ed8f518..7aefa2bd2e5bc339fe63139890c46cd8dc6a6f04 100644 (file)
@@ -112,3 +112,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')