Harald Hoyer fe68ba
From 8ad32155907fc4accd0a822365f6fcf1c355cfcb Mon Sep 17 00:00:00 2001
Harald Hoyer fe68ba
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer fe68ba
Date: Mon, 7 May 2018 15:21:35 +0200
Harald Hoyer fe68ba
Subject: [PATCH] don't error out, if no modules were installed
Harald Hoyer fe68ba
MIME-Version: 1.0
Harald Hoyer fe68ba
Content-Type: text/plain; charset=UTF-8
Harald Hoyer fe68ba
Content-Transfer-Encoding: 8bit
Harald Hoyer fe68ba
Harald Hoyer fe68ba
dracut-install … -m -s drm_crtc_init =drivers/staging
Harald Hoyer fe68ba
should not return an error, if no module was found in =drivers/staging
Harald Hoyer fe68ba
Harald Hoyer fe68ba
https://bugzilla.redhat.com/show_bug.cgi?id=1575527
Harald Hoyer fe68ba
---
Harald Hoyer fe68ba
 install/dracut-install.c | 6 +++++-
Harald Hoyer fe68ba
 1 file changed, 5 insertions(+), 1 deletion(-)
Harald Hoyer fe68ba
Harald Hoyer fe68ba
diff --git a/install/dracut-install.c b/install/dracut-install.c
Harald Hoyer fe68ba
index 4b2ff896..14fc0ab9 100644
Harald Hoyer fe68ba
--- a/install/dracut-install.c
Harald Hoyer fe68ba
+++ b/install/dracut-install.c
Harald Hoyer fe68ba
@@ -1394,6 +1394,7 @@ static int install_modules(int argc, char **argv)
Harald Hoyer fe68ba
         const char *abskpath = NULL;
Harald Hoyer fe68ba
         char *p;
Harald Hoyer fe68ba
         int i;
Harald Hoyer fe68ba
+        int modinst = 0;
Harald Hoyer fe68ba
 
Harald Hoyer fe68ba
         ctx = kmod_new(kerneldir, NULL);
Harald Hoyer fe68ba
         abskpath = kmod_get_dirname(ctx);
Harald Hoyer fe68ba
@@ -1498,6 +1499,7 @@ static int install_modules(int argc, char **argv)
Harald Hoyer fe68ba
                                         return -ENOENT;
Harald Hoyer fe68ba
                                 };
Harald Hoyer fe68ba
                                 ret = ( ret == 0 ? 0 : r );
Harald Hoyer fe68ba
+                                modinst = 1;
Harald Hoyer fe68ba
                         }
Harald Hoyer fe68ba
                 } else if (argv[i][0] == '=') {
Harald Hoyer fe68ba
                         _cleanup_free_ char *path1 = NULL, *path2 = NULL, *path3 = NULL;
Harald Hoyer fe68ba
@@ -1592,6 +1594,7 @@ static int install_modules(int argc, char **argv)
Harald Hoyer fe68ba
                                                 return -ENOENT;
Harald Hoyer fe68ba
                                         };
Harald Hoyer fe68ba
                                         ret = ( ret == 0 ? 0 : r );
Harald Hoyer fe68ba
+                                        modinst = 1;
Harald Hoyer fe68ba
                                 }
Harald Hoyer fe68ba
                         }
Harald Hoyer fe68ba
                         if (errno) {
Harald Hoyer fe68ba
@@ -1638,10 +1641,11 @@ static int install_modules(int argc, char **argv)
Harald Hoyer fe68ba
                                         return -ENOENT;
Harald Hoyer fe68ba
                                 };
Harald Hoyer fe68ba
                                 ret = ( ret == 0 ? 0 : r );
Harald Hoyer fe68ba
+                                modinst = 1;
Harald Hoyer fe68ba
                         }
Harald Hoyer fe68ba
                 }
Harald Hoyer fe68ba
 
Harald Hoyer fe68ba
-                if ((ret != 0) && (!arg_optional)) {
Harald Hoyer fe68ba
+                if ((modinst != 0) && (ret != 0) && (!arg_optional)) {
Harald Hoyer fe68ba
                         if (!arg_silent)
Harald Hoyer fe68ba
                                 log_error("ERROR: installing '%s'", argv[i]);
Harald Hoyer fe68ba
                         return EXIT_FAILURE;
Harald Hoyer fe68ba