Skip to content

Commit 157baa8

Browse files
committed
meson: support both separate and merged sbin-bin directories
Follow-up for ba7f4ae. 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 ba7f4ae and this patch.
1 parent 2675413 commit 157baa8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

meson.build

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ else
6161
endif
6262
conf.set10('HAVE_SPLIT_USR', split_usr)
6363

64+
if get_option('split-bin') == 'auto'
65+
split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
66+
else
67+
split_bin = get_option('split-bin') == 'true'
68+
endif
69+
6470
rootprefixdir = get_option('rootprefix')
6571
# Unusual rootprefixdir values are used by some distros
6672
# (see https://github.com/systemd/systemd/pull/7461).
@@ -91,7 +97,7 @@ datadir = join_paths(prefixdir, get_option('datadir'))
9197
localstatedir = join_paths('/', get_option('localstatedir'))
9298

9399
rootbindir = join_paths(rootprefixdir, 'bin')
94-
rootsbindir = join_paths(rootprefixdir, 'sbin')
100+
rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
95101
rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
96102

97103
rootlibdir = get_option('rootlibdir')
@@ -2743,6 +2749,7 @@ status = [
27432749
'@0@ @1@'.format(meson.project_name(), meson.project_version()),
27442750

27452751
'split /usr: @0@'.format(split_usr),
2752+
'split bin-sbin: @0@'.format(split_bin),
27462753
'prefix directory: @0@'.format(prefixdir),
27472754
'rootprefix directory: @0@'.format(rootprefixdir),
27482755
'sysconf directory: @0@'.format(sysconfdir),

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'],
2020
description : '''/bin, /sbin aren't symlinks into /usr''')
21+
option('split-bin', type : 'combo', choices : ['auto', 'true', 'false'],
22+
description : '''sbin is not a symlink to bin''')
2123
option('rootlibdir', type : 'string',
2224
description : '''[/usr]/lib/x86_64-linux-gnu or such''')
2325
option('rootprefix', type : 'string',

0 commit comments

Comments
 (0)