summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-03-01 21:48:36 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:59:11 +0200
commita73ff5e5b4372cd8e9e97ee875c9fd48a69fb84b (patch)
tree2d975c3691d99832d82b2bf0b698fa60433ff7d3
parent06aedd5e7157c2d282a5aa2469f5bfd657a459e3 (diff)
Remove /sbin from paths if split-bin is false (#8324)
Follow-up for 157baa87e4.
-rw-r--r--meson.build5
-rw-r--r--src/basic/path-util.h10
2 files changed, 12 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index a10499131..163e27b12 100644
--- a/meson.build
+++ b/meson.build
@@ -75,13 +75,16 @@ if get_option('split-usr') == 'auto'
else
split_usr = get_option('split-usr') == 'true'
endif
-conf.set10('HAVE_SPLIT_USR', split_usr)
+conf.set10('HAVE_SPLIT_USR', split_usr,
+ description : '/usr/bin and /bin directories are separate')
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
+conf.set10('HAVE_SPLIT_BIN', split_bin,
+ description : 'bin and sbin directories are separate')
rootprefixdir = get_option('rootprefix')
# Unusual rootprefixdir values are used by some distros
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 9faa128e3..38cd89e32 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -28,8 +28,14 @@
#include "string-util.h"
#include "time-util.h"
-#define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
-#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin"
+#if HAVE_SPLIT_BIN
+# define PATH_SBIN_BIN(x) x "sbin:" x "bin"
+#else
+# define PATH_SBIN_BIN(x) x "bin"
+#endif
+
+#define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/")
+#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/")
#if HAVE_SPLIT_USR
# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR