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

[PATCH rhel6-branch] (take II) Set repository in kickstart harddrive command (#592239)



With the patch, harddrive ks command behaves same as url/nfs commands
wrt base repository setting, the case (2) below is fixed:

The base repo is set this way:

(1) If location ends with .img (e.g --dir=/images/install.img).
we use repos from /etc/anaconda.repos.d (release package)
Boot parameter repo= can be used to specify the repo.

(2) If url/--dir doesn't end with .img (e.g --dir=/) we use it
to set base repo location. Boot parameter repo= is overriden
in this case.

Note: part of the bug is caused by rhel-beta repository being
disabled in snap4's /etc/yum.repos.d/rehl-beta.

---
 loader/hdinstall.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/loader/hdinstall.c b/loader/hdinstall.c
index 54a5fd9..154d5bc 100644
--- a/loader/hdinstall.c
+++ b/loader/hdinstall.c
@@ -339,6 +339,8 @@ char * mountHardDrive(struct installMethod * method,
 void setKickstartHD(struct loaderData_s * loaderData, int argc,
                      char ** argv) {
     char *p;
+    char *url = NULL;
+    char *substr = NULL;
     gchar *biospart = NULL, *partition = NULL, *dir = NULL;
     GOptionContext *optCon = g_option_context_new(NULL);
     GError *optErr = NULL;
@@ -391,6 +393,15 @@ void setKickstartHD(struct loaderData_s * loaderData, int argc,
     if (dir)
         ((struct hdInstallData *)loaderData->stage2Data)->directory = dir;
 
+    if (partition && dir) {
+        /* set repo only if location of stage 2 is not specified explicitly in --dir */
+        substr = strstr(dir, ".img");
+        if (!substr || (substr && *(substr+4) != '\0')) {
+            checked_asprintf(&url, "hd:%s:%s", partition, dir)
+            loaderData->instRepo = url;
+        }
+    }
+
     logMessage(INFO, "results of hd ks, partition is %s, dir is %s", partition,
                dir);
 }
-- 
1.6.0.6


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