AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-I$(top_srcdir)/libkmod \
+ -DROOTPREFIX=\""$(rootprefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\"
required_private_libs=""
+AC_ARG_WITH([rootprefix],
+ AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
+ [], [with_rootprefix=$prefix])
+AC_SUBST([rootprefix], [$with_rootprefix])
+
AC_ARG_ENABLE([tools],
AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]),
[], enable_tools=yes)
========
prefix: ${prefix}
+ rootprefix: ${rootprefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
includedir: ${includedir}
static const char *default_config_paths[] = {
"/run/modprobe.d",
- "/etc/modprobe.d",
- "/lib/modprobe.d",
+ SYSCONFDIR "/modprobe.d",
+ ROOTPREFIX "/lib/modprobe.d",
NULL
};
return 0;
}
-static const char *dirname_default_prefix = "/lib/modules";
+static const char *dirname_default_prefix = ROOTPREFIX "/lib/modules";
static char *get_kernel_release(const char *dirname)
{
* release the resources of the kmod library context.
*
* @dirname: what to consider as linux module's directory, if NULL
- * defaults to /lib/modules/`uname -r`.
+ * defaults to $rootprefix/lib/modules/`uname -r`.
* @config_paths: ordered array of paths (directories or files) where
* to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If
* NULL defaults to /run/modprobe.d, /etc/modprobe.d and
- * /lib/modprobe.d. Give an empty vector if configuration should
+ * $rootprefix/lib/modprobe.d. Give an empty vector if configuration should
* not be read. This array must be null terminated.
*
* Returns: a new kmod library context
"\t-0, --null Use \\0 instead of \\n\n"
"\t-F, --field=FIELD Print only provided FIELD\n"
"\t-k, --set-version=VERSION Use VERSION instead of `uname -r`\n"
- "\t-b, --basedir=DIR Use DIR as filesystem root for /lib/modules\n"
+ "\t-b, --basedir=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
"\t-V, --version Show version\n"
"\t-h, --help Show this help\n",
progname);
}
kversion = u.release;
}
- snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" ROOTPREFIX "/lib/modules/%s",
root, kversion);
dirname = dirname_buf;
}
"\t-n, --dry-run Do not execute operations, just print out\n"
"\t-n, --show Same as --dry-run\n"
- "\t-C, --config=FILE Use FILE instead of /etc/modprobe.d\n"
- "\t-d, --dirname=DIR Use DIR as filesystem root for /lib/modules\n"
+ "\t-C, --config=FILE Use FILE instead of " SYSCONFDIR "/modprobe.d\n"
+ "\t-d, --dirname=DIR Use DIR as filesystem root for " ROOTPREFIX "/lib/modules\n"
"\t-S, --set-version=VERSION Use VERSION instead of `uname -r`\n"
"\t-s, --syslog print to syslog, not stderr\n"
}
kversion = u.release;
}
- snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s",
+ snprintf(dirname_buf, sizeof(dirname_buf), "%s" ROOTPREFIX "/lib/modules/%s",
root, kversion);
dirname = dirname_buf;
}