[PATCH] Update the method string handling for NFS and URL installs.

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

 



yum doesn't understand nfs: and nfsiso: URLs, so we've been mangling them
early in the anaconda file.  Now with stage2=, we need to do this later
because in the NFS case, we won't have the source repo mounted.  Delay the
mangling until we're doing repo setup, which is also where the NFS source
will get mounted.
---
 anaconda      |   26 ++++++++++++++++----------
 yuminstall.py |    9 ++++++++-
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/anaconda b/anaconda
index a0fd789..0f2a144 100755
--- a/anaconda
+++ b/anaconda
@@ -558,22 +558,28 @@ class Anaconda:
         # real URIs, though.
         self._loaderMethodstr = methodstr
 
-        if methodstr.startswith("nfs://"):
-            self.methodstr = "file:///" + methodstr[6:]
-        elif methodstr.startswith("nfsiso:/"):
-            self.methodstr = "file://" + methodstr[8:]
-        elif methodstr.startswith("cdrom://"):
-            (device, tree) = string.split(methodstr[8:], ":", 1)
+        # Make a best guess at where the repo is by trimming off the image file
+        # from the end.  If this doesn't work, we've got repo reconfig screens
+        # to use later on.
+        if methodstr.endswith(".img"):
+            try:
+                m = methodstr[:methodstr.rindex("/")]
+                m = m[:m.rindex("/")]
+            except:
+                m = methodstr
+        else:
+            m = methodstr
+
+        if m.startswith("cdrom://"):
+            (device, tree) = string.split(m[8:], ":", 1)
 
             if not tree.startswith("/"):
                 tree = "/%s" %(tree,)
 
             self.mediaDevice = device
             self.methodstr = "file://" + tree
-        elif methodstr.startswith("hd://"):
-            self.methodstr = "file:///mnt/source"
         else:
-            self.methodstr = methodstr
+            self.methodstr = m
 
     def writeMethodstr(self, f):
         import urllib
@@ -588,7 +594,7 @@ class Anaconda:
             partition = string.split(self._loaderMethodstr[pidx:pidx+didx], ':')[0]
             dir = self._loaderMethodstr[pidx+didx+1:]
             f.write("harddrive --partition=%s --dir=%s\n" % (partition, dir))
-        elif self._loaderMethodstr.startswith('nfs:/') or self._loaderMethodstr.startswith('nfsiso:'):
+        elif self._loaderMethodstr.startswith('nfs:') or self._loaderMethodstr.startswith('nfsiso:'):
             (method, tmpmntpt) = string.split(self._loaderMethodstr, ':')
             # clean up extra '/' at front
             if tmpmntpt[1] == '/':
diff --git a/yuminstall.py b/yuminstall.py
index f4ba51d..7de9b09 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -445,12 +445,19 @@ class AnacondaYum(YumSorter):
         self.conf.cachedir = '/tmp/cache/'
         self.conf.metadata_expire = 0
 
+        if self.anaconda.methodstr.startswith("nfs:"):
+            methodstr = "file:///mnt/source"
+            if not os.path.ismount("/mnt/source"):
+                isys.mount(self.anaconda.methodstr[4:], "/mnt/source", "nfs")
+        elif self.anaconda.methodstr.startswith("ftp:") or self.anaconda.methodstr.startswith("http:"):
+            methodstr = self.anaconda.methodstr
+
         # set up logging to log to our logs
         ylog = logging.getLogger("yum")
         map(lambda x: ylog.addHandler(x), log.handlers)
 
         # add default repos
-        for (name, uri) in self.anaconda.id.instClass.getPackagePaths(self.anaconda.methodstr).items():
+        for (name, uri) in self.anaconda.id.instClass.getPackagePaths(methodstr).items():
             rid = name.replace(" ", "")
             repo = AnacondaYumRepo(uri, addon=False,
                                    repoid="anaconda-%s-%s" %(rid, productStamp),
-- 
1.5.3.7

_______________________________________________
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