]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
don't error out, if no modules were installed
authorHarald Hoyer <harald@redhat.com>
Mon, 7 May 2018 13:21:35 +0000 (15:21 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 7 May 2018 13:21:35 +0000 (15:21 +0200)
dracut-install … -m -s drm_crtc_init =drivers/staging
should not return an error, if no module was found in =drivers/staging

https://bugzilla.redhat.com/show_bug.cgi?id=1575527

install/dracut-install.c

index 4b2ff896d37d3b5f1f7d44fbb473a42a5d46fd14..14fc0ab9a653e7eab082b0fe148034f724b1c337 100644 (file)
@@ -1394,6 +1394,7 @@ static int install_modules(int argc, char **argv)
         const char *abskpath = NULL;
         char *p;
         int i;
+        int modinst = 0;
 
         ctx = kmod_new(kerneldir, NULL);
         abskpath = kmod_get_dirname(ctx);
@@ -1498,6 +1499,7 @@ static int install_modules(int argc, char **argv)
                                         return -ENOENT;
                                 };
                                 ret = ( ret == 0 ? 0 : r );
+                                modinst = 1;
                         }
                 } else if (argv[i][0] == '=') {
                         _cleanup_free_ char *path1 = NULL, *path2 = NULL, *path3 = NULL;
@@ -1592,6 +1594,7 @@ static int install_modules(int argc, char **argv)
                                                 return -ENOENT;
                                         };
                                         ret = ( ret == 0 ? 0 : r );
+                                        modinst = 1;
                                 }
                         }
                         if (errno) {
@@ -1638,10 +1641,11 @@ static int install_modules(int argc, char **argv)
                                         return -ENOENT;
                                 };
                                 ret = ( ret == 0 ? 0 : r );
+                                modinst = 1;
                         }
                 }
 
-                if ((ret != 0) && (!arg_optional)) {
+                if ((modinst != 0) && (ret != 0) && (!arg_optional)) {
                         if (!arg_silent)
                                 log_error("ERROR: installing '%s'", argv[i]);
                         return EXIT_FAILURE;