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

[PATCH 1/2 rhel5-branch f14-branch master] Add noeject support to loader2 (#477887)



When noeject is passed on the kernel command line disable ejecting the
cdrom.

Related: rhbz#477887
---
 loader2/cdinstall.c |   30 +++++++++++++++++++++++-------
 loader2/loader.c    |    6 ++++--
 loader2/loader.h    |    2 ++
 3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index 0b47b6a..ee837ad 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -108,8 +108,11 @@ static char * mediaCheckCdrom(char *cddriver) {
                 free(descr);
         }
 
-        ejectCdrom();
-	
+        if (!FL_NOEJECT(flags))
+            ejectCdrom();
+        else
+            logMessage(INFO, "noeject in effect, not ejecting cdrom");
+
         rc = newtWinChoice(_("Media Check"), _("Test"), _("Continue"),
                        _("If you would like to test additional media, "
                        "insert the next CD and press \"%s\". "
@@ -121,7 +124,10 @@ static char * mediaCheckCdrom(char *cddriver) {
                        _("Test"), _("Continue"));
 
         if (rc == 2) {
-            unlink("/tmp/cdrom");
+            if (!FL_NOEJECT(flags))
+                unlink("/tmp/cdrom");
+            else
+                logMessage(INFO, "noeject in effect, not unmounting /tmp/cdrom");
             return NULL;
         } else {
             continue;
@@ -156,7 +162,10 @@ static void mountCdromStage2(char *cddev) {
         do {
             if (doPwMount("/tmp/cdrom", "/mnt/source", 
                           "iso9660", IMOUNT_RDONLY, NULL)) {
-                ejectCdrom();
+                if (!FL_NOEJECT(flags))
+                    ejectCdrom();
+                else
+                    logMessage(INFO, "noeject in effect, not ejecting cdrom");
                 wrongCDMessage();
             } else {
                 break;
@@ -168,7 +177,10 @@ static void mountCdromStage2(char *cddev) {
         /* if we failed, umount /mnt/source and keep going */
         if (rc) {
             umount("/mnt/source");
-            ejectCdrom();
+            if (!FL_NOEJECT(flags))
+                ejectCdrom();
+            else
+                logMessage(INFO, "noeject in effect, not ejecting cdrom");
             wrongCDMessage();
         } else {
             gotcd1 = 1;
@@ -386,8 +398,12 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
                                    "and press %s to retry."), getProductName(),
                                  getProductName(), _("OK"));
 
-            ejectCdrom();
-            unlink("/tmp/cdrom");
+            if (!FL_NOEJECT(flags)) {
+                ejectCdrom();
+                unlink("/tmp/cdrom");
+            } else {
+                logMessage(INFO, "noeject in effect, not ejecting cdrom");
+            }
             rc = newtWinChoice(_("CD Not Found"),
                                _("OK"), _("Back"), buf, _("OK"));
             free(buf);
diff --git a/loader2/loader.c b/loader2/loader.c
index 27ba97a..8b922d9 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -708,9 +708,11 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
             flags |= LOADER_FLAGS_NOIPV4;
         } else if (!strcasecmp(argv[i], "noipv6")) {
             flags |= LOADER_FLAGS_NOIPV6;
-        } else if (!strcasecmp(argv[i], "kssendmac"))
+        } else if (!strcasecmp(argv[i], "kssendmac")) {
             flags |= LOADER_FLAGS_KICKSTART_SEND_MAC;
-        else if (!strncasecmp(argv[i], "loglevel=", 9)) {
+        } else if (!strcasecmp(argv[i], "noeject")) {
+            flags |= LOADER_FLAGS_NOEJECT;
+        } else if (!strncasecmp(argv[i], "loglevel=", 9)) {
             if (!strcasecmp(argv[i]+9, "debug")) {
                 loaderData->logLevel = strdup(argv[i]+9);
                 setLogLevel(DEBUGLVL);
diff --git a/loader2/loader.h b/loader2/loader.h
index cff59b7..4d3007a 100644
--- a/loader2/loader.h
+++ b/loader2/loader.h
@@ -48,6 +48,7 @@
 #define LOADER_FLAGS_IS_KICKSTART       (((uint64_t) 1) << 35)
 #define LOADER_FLAGS_HAVE_CMSCONF       (((uint64_t) 1) << 36)
 #define LOADER_FLAGS_AUTOMODDISK        (((uint64_t) 1) << 37)
+#define LOADER_FLAGS_NOEJECT            (((uint64_t) 1) << 38)
 
 #define FL_TESTING(a)            ((a) & LOADER_FLAGS_TESTING)
 #define FL_EXPERT(a)             ((a) & LOADER_FLAGS_EXPERT)
@@ -91,6 +92,7 @@
 #define FL_IS_KICKSTART(a)       ((a) & LOADER_FLAGS_IS_KICKSTART)
 #define FL_HAVE_CMSCONF(a)       ((a) & LOADER_FLAGS_HAVE_CMSCONF)
 #define FL_AUTOMODDISK(a)        ((a) & LOADER_FLAGS_AUTOMODDISK)
+#define FL_NOEJECT(a)            ((a) & LOADER_FLAGS_NOEJECT)
 
 void startNewt(void);
 void stopNewt(void);
-- 
1.7.2.2


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