]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
introduce --with-rootprefix=DIR
authorKay Sievers <kay.sievers@vrfy.org>
Tue, 20 Dec 2011 16:58:05 +0000 (17:58 +0100)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 20 Dec 2011 18:22:07 +0000 (16:22 -0200)
Configure the location of the rootfs directories and use it
to find (/usr)/lib/modules and (/usr)/lib/modprobe.d.

Makefile.am
configure.ac
libkmod/libkmod.c
tools/kmod-modinfo.c
tools/kmod-modprobe.c

index 79e12dbc1cb7b967da508fd301d77e6d7bbd8e1b..46c025a0cd22130bb8c7495e31ba8f00edef3dfe 100644 (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)"\"
 
index 8999de897020267c3529cae64d77c736a6ed8653..e9eb08d6668bba8c05e72ec60c991048e92a150a 100644 (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}
index b519b90345e4c1aeb76d10815148394ee96a97b7..699a17e9860d9480c8f716149708fc7012b08cb4 100644 (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
index a8274379900e89a017c367777df99ac53939bf36..fa91682ad476c95970117d7f2b833e26642c1808 100644 (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;
        }
index f78a7ac28513f9e3e560988ee395e0a31f8a8992..6fa1066131653acf911257293cf05b2af873c485 100644 (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;
        }