void-packages/srcpkgs/lxc/patches/02-distrosysconfdir.patch

64 lines
2.2 KiB
Diff

From 16ebb29dccb35bf74e8a19e8c45d2513f927476f Mon Sep 17 00:00:00 2001
Message-Id: <16ebb29dccb35bf74e8a19e8c45d2513f927476f.1660130248.git.congdanhqx@gmail.com>
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Tue, 9 Aug 2022 22:24:09 +0700
Subject: [PATCH] meson.build: allow explicit distrosysconfdir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 | 8 ++++++--
meson_options.txt | 3 +++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index a145faf0..b27cc8ed 100644
--- a/meson.build
+++ b/meson.build
@@ -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.
diff --git a/meson_options.txt b/meson_options.txt
index c14dacf2..de583a08 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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')
--
2.37.1.561.ga4036fcf2c