[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 4/5] Write /tmp/anaconda.conf (#569883)



So that the modules will remain blacklisted through reboots, write out
a blacklist file for modprobe. This is copied to /etc/modprobe.d/ by
yuminstall.py after the filesystem is formatted

Related: rhbz#569883
---
 loader2/loader.c  |    3 +++
 loader2/modules.c |   23 +++++++++++++++++++++++
 loader2/modules.h |    1 +
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/loader2/loader.c b/loader2/loader.c
index db22da3..488bb5b 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -1819,6 +1819,9 @@ int main(int argc, char ** argv) {
      * describing which scsi disks go with which scsi adapters */
     writeScsiDisks(modLoaded);
 
+    /* Write out the module blacklist file */
+    mlWriteBlacklist();
+
     /* if we are in rescue mode lets load st.ko for tape support */
     if (FL_RESCUE(flags))
         scsiTapeInitialize(modLoaded, modDeps, modInfo);
diff --git a/loader2/modules.c b/loader2/modules.c
index b79eb50..28c1851 100644
--- a/loader2/modules.c
+++ b/loader2/modules.c
@@ -1125,3 +1125,26 @@ void loadKickstartModule(struct loaderData_s * loaderData, int argc,
                  loaderData->modInfo, args);
 }
 
+void mlWriteBlacklist() {
+    int fd;
+    int i;
+    int ret;
+    char *buf;
+
+    /* Write out the blacklist, used by modprobe on bootup */
+    fd = open("/tmp/anaconda.conf", O_WRONLY | O_CREAT, 0666);
+    if (fd == -1) {
+        logMessage(ERROR, "error writing /tmp/anaconda.conf: %s\n",
+                    strerror(errno));
+        return;
+    }
+    for (i=0; i < cmdline_argc; i++) {
+        if (!strncasecmp(cmdline_argv[i], "blacklist=", 10)) {
+            asprintf( &buf, "blacklist %s\n", cmdline_argv[i] + 10 );
+            ret = write(fd, buf, strlen(buf));
+            free(buf);
+        }
+    }
+    close(fd);
+}
+
diff --git a/loader2/modules.h b/loader2/modules.h
index bbcc905..536a199 100644
--- a/loader2/modules.h
+++ b/loader2/modules.h
@@ -41,4 +41,5 @@ void writeScsiDisks(moduleList list);
 int removeLoadedModule(const char * modName, moduleList modLoaded);
 char * getModuleLocation(int version);
 
+void mlWriteBlacklist();
 #endif
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]