introduce --with-rootprefix=DIR

Configure the location of the rootfs directories and use it
to find (/usr)/lib/modules and (/usr)/lib/modprobe.d.
This commit is contained in:
Kay Sievers 2011-12-20 17:58:05 +01:00 committed by Lucas De Marchi
parent 7fe5f7abce
commit a308abec37
5 changed files with 17 additions and 10 deletions

View File

@ -6,6 +6,7 @@ AM_MAKEFLAGS = --no-print-directory
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-I$(top_srcdir)/libkmod \
-DROOTPREFIX=\""$(rootprefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\"

View File

@ -27,6 +27,11 @@ AC_C_BIGENDIAN
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)
@ -147,6 +152,7 @@ AC_MSG_RESULT([
========
prefix: ${prefix}
rootprefix: ${rootprefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
includedir: ${includedir}

View File

@ -60,8 +60,8 @@ static const char* index_files[] = {
static const char *default_config_paths[] = {
"/run/modprobe.d",
"/etc/modprobe.d",
"/lib/modprobe.d",
SYSCONFDIR "/modprobe.d",
ROOTPREFIX "/lib/modprobe.d",
NULL
};
@ -159,7 +159,7 @@ static int log_priority(const char *priority)
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)
{
@ -188,12 +188,12 @@ 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

View File

@ -320,7 +320,7 @@ static void help(const char *progname)
"\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);
@ -402,7 +402,7 @@ int main(int argc, char *argv[])
}
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;
}

View File

@ -125,8 +125,8 @@ static void help(const char *progname)
"\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"
@ -1252,7 +1252,7 @@ int main(int argc, char **orig_argv)
}
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;
}