summaryrefslogtreecommitdiff
path: root/lxc/02-distrosysconfdir.patch
blob: aff41ff4914478531113b2ca3b4d03e27b5eacfe (plain)
    1 From 16ebb29dccb35bf74e8a19e8c45d2513f927476f Mon Sep 17 00:00:00 2001
    2 Message-Id: <16ebb29dccb35bf74e8a19e8c45d2513f927476f.1660130248.git.congdanhqx@gmail.com>
    3 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
    4  <congdanhqx@gmail.com>
    5 Date: Tue, 9 Aug 2022 22:24:09 +0700
    6 Subject: [PATCH] meson.build: allow explicit distrosysconfdir
    7 MIME-Version: 1.0
    8 Content-Type: text/plain; charset=UTF-8
    9 Content-Transfer-Encoding: 8bit
   10 
   11 Allows either:
   12 
   13 - Build inside minimal-and-clean chroot with neither
   14   /etc/sysconfig nor /etc/default available.
   15 - Cross Compile lxc from foreign distro,
   16   let's say host distro uses /etc/sysconfig and build distro
   17   uses /etc/default and vice versus.
   18 
   19 Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
   20 ---
   21  meson.build       | 8 ++++++--
   22  meson_options.txt | 3 +++
   23  2 files changed, 9 insertions(+), 2 deletions(-)
   24 
   25 diff --git a/meson.build b/meson.build
   26 index a145faf0..b27cc8ed 100644
   27 --- a/meson.build
   28 +++ b/meson.build
   29 @@ -117,14 +117,18 @@ conf.set('SYSCONFDIR', sysconfdir)
   30  
   31  # Set sysconfdir
   32  fs = import('fs')
   33 -if fs.is_dir('/etc/sysconfig')
   34 +distrosysconfdir = get_option('distrosysconfdir')
   35 +if distrosysconfdir != ''
   36 +    distrosysconfdir = join_paths(sysconfdir, distrosysconfdir)
   37 +    conf.set('LXC_DISTRO_SYSCONF', distrosysconfdir)
   38 +elif fs.is_dir('/etc/sysconfig')
   39      distrosysconfdir = join_paths(sysconfdir, 'sysconfig')
   40      conf.set('LXC_DISTRO_SYSCONF', distrosysconfdir)
   41  elif fs.is_dir('/etc/default')
   42      distrosysconfdir = join_paths(sysconfdir, 'default')
   43      conf.set('LXC_DISTRO_SYSCONF', distrosysconfdir)
   44  else
   45 -    distrosysconfdir = ''
   46 +    error('"distrosysconfdir" is not set')
   47  endif
   48  
   49  # Cross-compile on Android.
   50 diff --git a/meson_options.txt b/meson_options.txt
   51 index c14dacf2..de583a08 100644
   52 --- a/meson_options.txt
   53 +++ b/meson_options.txt
   54 @@ -115,3 +115,6 @@ option('thread-safety', type : 'boolean', value : 'true',
   55  # was --{disable,enable}-memfd-rexec in autotools
   56  option('memfd-rexec', type : 'boolean', value : 'true',
   57         description : 'whether to rexec the lxc-attach binary when attaching to a container')
   58 +
   59 +option('distrosysconfdir', type : 'string', value: '',
   60 +       description: 'relative path to sysconfdir for distro default configuration')
   61 -- 
   62 2.37.1.561.ga4036fcf2c

Generated by cgit