Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   Write /tmp/anaconda.conf (#569883) (http://www.linux-archive.org/device-mapper-development/498581-write-tmp-anaconda-conf-569883-a.html)

"Brian C. Lane" 03-08-2011 05:55 AM

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
",
+ strerror(errno));
+ return;
+ }
+ for (i=0; i < cmdline_argc; i++) {
+ if (!strncasecmp(cmdline_argv[i], "blacklist=", 10)) {
+ asprintf( &buf, "blacklist %s
", 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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Ales Kozumplik 03-08-2011 06:57 AM

Write /tmp/anaconda.conf (#569883)
 
On 03/08/2011 07:55 AM, Brian C. Lane wrote:

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
---
+ /* Write out the blacklist, used by modprobe on bootup */
+ fd = open("/tmp/anaconda.conf", O_WRONLY | O_CREAT, 0666);


Won't this override the file if it already existed?

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Chris Lumens 03-08-2011 03:05 PM

Write /tmp/anaconda.conf (#569883)
 
> +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);

Maybe I'm just paranoid, but I don't see why you'd do 0666 instead of
0644 or 0664.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 08:04 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.