From 2675413e39a38106949683bbda8fbf051d0aa021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 1 Mar 2018 11:49:42 +0100 Subject: [PATCH 1/2] meson: autodetect split-usr Also move the status from "features" to the paths section. This is more of an anti-feature. --- meson.build | 8 ++++++-- meson_options.txt | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index def2351f21..5f30bd3854 100644 --- a/meson.build +++ b/meson.build @@ -54,7 +54,11 @@ endif ##################################################################### -split_usr = get_option('split-usr') +if get_option('split-usr') == 'auto' + split_usr = run_command('test', '-L', '/bin').returncode() != 0 +else + split_usr = get_option('split-usr') == 'true' +endif conf.set10('HAVE_SPLIT_USR', split_usr) rootprefixdir = get_option('rootprefix') @@ -2738,6 +2742,7 @@ run_target( status = [ '@0@ @1@'.format(meson.project_name(), meson.project_version()), + 'split /usr: @0@'.format(split_usr), 'prefix directory: @0@'.format(prefixdir), 'rootprefix directory: @0@'.format(rootprefixdir), 'sysconf directory: @0@'.format(sysconfdir), @@ -2874,7 +2879,6 @@ foreach tuple : [ ['man pages', want_man], ['html pages', want_html], ['man page indices', want_man and have_lxml], - ['split /usr', conf.get('HAVE_SPLIT_USR') == 1], ['SysV compat'], ['utmp'], ['ldconfig'], diff --git a/meson_options.txt b/meson_options.txt index dca9dfc16c..4dbbb5190a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,8 +16,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see . -option('split-usr', type : 'boolean', value : false, - description : '''assume that /bin, /sbin aren't symlinks into /usr''') +option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'], + description : '''/bin, /sbin aren't symlinks into /usr''') option('rootlibdir', type : 'string', description : '''[/usr]/lib/x86_64-linux-gnu or such''') option('rootprefix', type : 'string', From 157baa87e437001004160018fc009c1ccb07c573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 1 Mar 2018 10:28:29 +0100 Subject: [PATCH 2/2] meson: support both separate and merged sbin-bin directories Follow-up for ba7f4ae6178309dc937e10cf7dce0eca9dafb8de. By default, we detect if the real root has a separate /usr/sbin directory, but this can be overrides with -Dsplit-bin=true|false. The check assumes that /usr/sbin is split if it is not a symlink, so it'll return a false negative with some more complicated setups. But that's OK, in those cases this should be configured explicitly. This will copy the structure of the directories in the root file system to $DESTDIR. If a directory is a directory in $DESTDIR but a symlink in the root file system, this script will fail. This means that it's not possible to reuse a $DESTDIR from between ba7f4ae61 and this patch. --- meson.build | 9 ++++++++- meson_options.txt | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 5f30bd3854..607502c937 100644 --- a/meson.build +++ b/meson.build @@ -61,6 +61,12 @@ else endif conf.set10('HAVE_SPLIT_USR', split_usr) +if get_option('split-bin') == 'auto' + split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0 +else + split_bin = get_option('split-bin') == 'true' +endif + rootprefixdir = get_option('rootprefix') # Unusual rootprefixdir values are used by some distros # (see https://github.com/systemd/systemd/pull/7461). @@ -91,7 +97,7 @@ datadir = join_paths(prefixdir, get_option('datadir')) localstatedir = join_paths('/', get_option('localstatedir')) rootbindir = join_paths(rootprefixdir, 'bin') -rootsbindir = join_paths(rootprefixdir, 'sbin') +rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin') rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd') rootlibdir = get_option('rootlibdir') @@ -2743,6 +2749,7 @@ status = [ '@0@ @1@'.format(meson.project_name(), meson.project_version()), 'split /usr: @0@'.format(split_usr), + 'split bin-sbin: @0@'.format(split_bin), 'prefix directory: @0@'.format(prefixdir), 'rootprefix directory: @0@'.format(rootprefixdir), 'sysconf directory: @0@'.format(sysconfdir), diff --git a/meson_options.txt b/meson_options.txt index 4dbbb5190a..2d27981849 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,6 +18,8 @@ option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'], description : '''/bin, /sbin aren't symlinks into /usr''') +option('split-bin', type : 'combo', choices : ['auto', 'true', 'false'], + description : '''sbin is not a symlink to bin''') option('rootlibdir', type : 'string', description : '''[/usr]/lib/x86_64-linux-gnu or such''') option('rootprefix', type : 'string',