[CentOS-devel] Lots of updates to EL5.x

Fri Jul 22 08:08:57 UTC 2011
Tetsuo Handa <from-centos at I-love.SAKURA.ne.jp>

I was wondering why CentOS 5 can't use network installation via proxy.
I've just made a patch. Not compiled/tested yet. Does somebody want to try?
--------------------
[Request for testers] PATCH: Network installation via proxy.

/sbin/loader included in the installation media's isolinux/initrd.img provides
support for network installation via proxy. However, due to a bug in
mountUrlImage() in loader2/urlinstall.c , users cannot use proxy.
Fix this bug by forcibly calling screen for configuring proxy if the kernel
command line contains the string "useproxy".

Signed-off-by: Tetsuo Handa <penguin-kernel at I-love.SAKURA.ne.jp>
---
 loader2/urls.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

--- anaconda-11.1.2.242.orig/loader2/urls.c
+++ anaconda-11.1.2.242/loader2/urls.c
@@ -279,6 +279,25 @@ int urlMainSetupPanel(struct iurlinfo * 
     else
         *doSecondarySetup = ' ';
 
+    /*
+     * Since mountUrlImage() in loader2/urlinstall.c calls this function with
+     * memset(&ui, 0, sizeof(ui)); called, *doSecondarySetup is always ' '.
+     * As a result, users can't use network installation via proxy.
+     * Fix it by forcibly changing *doSecondarySetup to '*' if /proc/cmdline
+     * contains the string "useproxy".
+     */
+    {
+	    const int fd = open("/proc/cmdline", O_RDONLY);
+	    if (fd != EOF) {
+		    char buffer[1024];
+		    memset(buffer, 0, sizeof(buffer));
+		    read(fd, buffer, sizeof(buffer) - 1);
+		    close(fd);
+		    if (strstr(buffer, "useproxy"))
+			    *doSecondarySetup = '*';
+	    }
+    }
+
     buttons = newtButtonBar(_("OK"), &okay, _("Back"), &cancel, NULL);
     
     switch (protocol) {