mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-03 21:27:00 +07:00
Changed --enable-split-usr to add hard-coded paths for rules etc in both / and /usr
This is necessary because the code originally defined paths assuming UDEV_LIBEXECDIR was /usr prefixed, and also that udevrulesdir was located in /etc. Since (1) both of these defaults have changed, and (2) they could be set to more or less anything, we want to ensure that there is support for the standard paths as well, irrespective of what UDEV_LIBEXECDIR and UDEV_RULES_DIR are set to. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
parent
7f14ef6bb1
commit
036bc1a950
@ -127,7 +127,7 @@ AC_ARG_ENABLE(
|
||||
[split-usr],
|
||||
[AS_HELP_STRING(
|
||||
[--enable-split-usr],
|
||||
[Assume that /bin, /sbin are not symlinks into /usr])],
|
||||
[Include hard-coded default search paths in / and /usr])],
|
||||
[],
|
||||
[AS_IF(
|
||||
[test "x${ac_default_prefix}" != "x${with_rootprefix}"],
|
||||
@ -137,7 +137,7 @@ AC_ARG_ENABLE(
|
||||
|
||||
AS_IF(
|
||||
[test "x${enable_split_usr}" = "xyes"],
|
||||
[AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin are not symlinks into /usr])]
|
||||
[AC_DEFINE(HAVE_SPLIT_USR, 1, [Define to include hard-coded default search paths in / and /usr])]
|
||||
)
|
||||
|
||||
# Configured paths
|
||||
|
@ -6,6 +6,7 @@ AM_CPPFLAGS = \
|
||||
-DROOTPREFIX=\"$(rootprefix)\" \
|
||||
-DUDEV_HWDB_DIR=\"$(udevhwdbdir)\" \
|
||||
-DUDEV_HWDB_BIN=\"$(udevhwdbbin)\" \
|
||||
-DUDEV_CONF_DIR=\"$(udevconfdir)\" \
|
||||
-DUDEV_RULES_DIR=\"$(udevrulesdir)\" \
|
||||
-DUDEV_LIBEXEC_DIR=\"$(udevlibexecdir)\" \
|
||||
-I $(top_srcdir)/src/libudev
|
||||
|
@ -687,9 +687,12 @@ int udev_event_spawn(struct udev_event *event,
|
||||
}
|
||||
|
||||
/* allow programs in /usr/lib/udev/ to be called without the path */
|
||||
/* NOTE - paths need reworking, see note in udev-rules.c */
|
||||
if (argv[0][0] != '/') {
|
||||
util_strscpyl(program, sizeof(program), UDEV_LIBEXEC_DIR "/", argv[0], NULL);
|
||||
#ifdef HAVE_SPLIT_USR
|
||||
if(access(program, X_OK))
|
||||
util_strscpyl(program, sizeof(program), "/usr/lib/udev/", argv[0], NULL);
|
||||
if(access(program, X_OK))
|
||||
util_strscpyl(program, sizeof(program), "/lib/udev/", argv[0], NULL);
|
||||
#endif
|
||||
|
@ -1600,11 +1600,28 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
|
||||
if (!rules->strbuf)
|
||||
return udev_rules_unref(rules);
|
||||
|
||||
rules->dirs = strv_new(UDEV_RULES_DIR,
|
||||
/* Note - need a better way to manage these paths:
|
||||
* ie, should have a list of paths we always support, and
|
||||
* do not include the #define vars if they are duplicates
|
||||
*
|
||||
* original - UDEV_RULES_DIR should be /etc/udev/rules.d
|
||||
* ..but we have it set to UDEV_LIBEXEC_DIR "/rules.d" so that
|
||||
* ..the default rules are installed there instead of in /etc
|
||||
*
|
||||
* original2 - UDEV_LIBEXEC_DIR used to be forced to /usr/lib/udev
|
||||
* ..by default, we have it as /lib/udev (or whatever rootlibdir is)
|
||||
* ..therefore we did not include /usr/lib/udev/rules.d.
|
||||
*
|
||||
* Reworked code; there are duplicate paths here but at least
|
||||
* everyting is listed.
|
||||
*/
|
||||
rules->dirs = strv_new(UDEV_CONF_DIR "/rules.d",
|
||||
UDEV_RULES_DIR,
|
||||
"/run/udev/rules.d",
|
||||
UDEV_LIBEXEC_DIR "/rules.d",
|
||||
#ifdef HAVE_SPLIT_USR
|
||||
"/lib/udev/rules.d",
|
||||
"/usr/lib/udev/rules.d",
|
||||
#endif
|
||||
NULL);
|
||||
if (!rules->dirs) {
|
||||
|
Loading…
Reference in New Issue
Block a user