[PATCH 1/2 rhel6-branch] Add noeject support to loader (#665094)

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

 



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

Related: rhbz#665094
---
 docs/command-line.txt |    3 +++
 loader/cdinstall.c    |   20 ++++++++++++++++----
 loader/loader.c       |    5 +++++
 loader/loader.h       |    2 ++
 4 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/docs/command-line.txt b/docs/command-line.txt
index fbc4b50..4723264 100644
--- a/docs/command-line.txt
+++ b/docs/command-line.txt
@@ -126,6 +126,9 @@
 ;<code>noipv6</code>
 : Disable IPv6 networking during installation.
 
+;<code>noeject</code>
+: Do not eject install media under any circumstances, including media test and shutdown.
+
 ;<code>nokill</code>
 : A debugging option that prevents anaconda from terminating all running programs when a fatal error occurs.
 
diff --git a/loader/cdinstall.c b/loader/cdinstall.c
index 3ccc332..74c9b14 100644
--- a/loader/cdinstall.c
+++ b/loader/cdinstall.c
@@ -201,7 +201,10 @@ static void mediaCheckCdrom(char *cddriver) {
                 free(descr);
         }
 
-        ejectCdrom(cddriver);
+        if (!FL_NOEJECT(flags))
+            ejectCdrom(cddriver);
+        else
+            logMessage(INFO, "noeject in effect, not ejecting cdrom");
 
         rc = newtWinChoice(_("Media Check"), _("Test"), _("Continue"),
                        _("If you would like to test additional media, "
@@ -260,7 +263,10 @@ static void queryCDMediaCheck(char *dev, char *location) {
 
             do {
                 if (doPwMount(dev, location, "iso9660", "ro", NULL)) {
-                    ejectCdrom(dev);
+                    if (!FL_NOEJECT(flags))
+                        ejectCdrom(dev);
+                    else
+                        logMessage(INFO, "noeject in effect, not ejecting cdrom");
                     wrongCDMessage();
                     continue;
                 }
@@ -271,7 +277,10 @@ static void queryCDMediaCheck(char *dev, char *location) {
                 if (access(stage2loc, R_OK)) {
                     free(stage2loc);
                     umount(location);
-                    ejectCdrom(dev);
+                    if (!FL_NOEJECT(flags))
+                        ejectCdrom(dev);
+                    else
+                        logMessage(INFO, "noeject in effect, not ejecting cdrom");
                     wrongCDMessage();
                     continue;
                 }
@@ -426,7 +435,10 @@ static char *setupCdrom(char *location, struct loaderData_s *loaderData,
                                          "and press %s to retry."),
                                  getProductName(), getProductName(), _("OK"));
 
-                ejectCdrom(cddev);
+                if (!FL_NOEJECT(flags))
+                    ejectCdrom(cddev);
+                else
+                    logMessage(INFO, "noeject in effect, not ejecting cdrom");
                 rc = newtWinChoice(_("Disc Not Found"),
                                    _("OK"), _("Back"), buf, _("OK"));
                 free(buf);
diff --git a/loader/loader.c b/loader/loader.c
index 52458d2..0f9bcb2 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1016,6 +1016,8 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
             mlAddBlacklist("uhci-hcd");
         } else if (!strcasecmp(argv[i], "nofirewire"))
             mlAddBlacklist("firewire-ohci");
+        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);
@@ -2372,6 +2374,9 @@ int main(int argc, char ** argv) {
         *argptr++ = "--noipv6";
 #endif
 
+    if (FL_NOEJECT(flags))
+        *argptr++ = "--noeject";
+
     if (FL_KICKSTART(flags)) {
         *argptr++ = "--kickstart";
         *argptr++ = loaderData.ksFile;
diff --git a/loader/loader.h b/loader/loader.h
index 58c785d..9e0accd 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -71,6 +71,7 @@
 #define LOADER_FLAGS_NOKILL		(((uint64_t) 1) << 38)
 #define LOADER_FLAGS_KICKSTART_SEND_SERIAL   (((uint64_t) 1) << 39)
 #define LOADER_FLAGS_AUTOMODDISK        (((uint64_t) 1) << 40)
+#define LOADER_FLAGS_NOEJECT            (((uint64_t) 1) << 41)
 
 #define FL_TEXT(a)               ((a) & LOADER_FLAGS_TEXT)
 #define FL_RESCUE(a)             ((a) & LOADER_FLAGS_RESCUE)
@@ -108,6 +109,7 @@
 #define FL_NOKILL(a)		 ((a) & LOADER_FLAGS_NOKILL)
 #define FL_KICKSTART_SEND_SERIAL(a) ((a) & LOADER_FLAGS_KICKSTART_SEND_SERIAL)
 #define FL_AUTOMODDISK(a)        ((a) & LOADER_FLAGS_AUTOMODDISK)
+#define FL_NOEJECT(a)            ((a) & LOADER_FLAGS_NOEJECT)
 
 void startNewt(void);
 void stopNewt(void);
-- 
1.7.3.4

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


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux