From 04fa94987767a035ebcf7a4bb46f1356e709d9e8 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 10 Oct 2017 13:29:41 +0200 Subject: [PATCH] Merge pull request #284 from sm00th/kmoddir dracut-install: fix relative paths in --kerneldir --- install/dracut-install.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/install/dracut-install.c b/install/dracut-install.c index 2c20b491..95425e8d 100644 --- a/install/dracut-install.c +++ b/install/dracut-install.c @@ -933,13 +933,6 @@ static int parse_argv(int argc, char *argv[]) break; case ARG_KERNELDIR: kerneldir = strdup(optarg); - if ((strncmp("/lib/modules/", kerneldir, 13) != 0) - && (strncmp("/usr/lib/modules/", kerneldir, 17) != 0)) { - char *p; - p = strstr(kerneldir, "/lib/modules/"); - if (p != NULL) - kerneldirlen = p - kerneldir; - } break; case ARG_FIRMWAREDIRS: firmwaredirs = strv_split(optarg, ":"); @@ -1399,9 +1392,17 @@ static int install_modules(int argc, char **argv) struct kmod_module *mod = NULL, *mod_o = NULL; const char *modname = NULL; + char *abskpath = NULL; + char *p; int i; ctx = kmod_new(kerneldir, NULL); + abskpath = kmod_get_dirname(ctx); + + p = strstr(abskpath, "/lib/modules/"); + if (p != NULL) + kerneldirlen = p - abskpath; + if (arg_hostonly) { char *modalias_file; modalias_file = getenv("DRACUT_KERNEL_MODALIASES");