~ubuntu-branches/ubuntu/raring/virtinst/raring-proposed

« back to all changes in this revision

Viewing changes to virtinst/DistroInstaller.py

  • Committer: Bazaar Package Importer
  • Author(s): Guido Günther
  • Date: 2009-12-07 10:04:22 UTC
  • mto: (1.6.3 sid)
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: james.westby@ubuntu.com-20091207100422-2izjffd5ljvqun47
Tags: upstream-0.500.1
Import upstream version 0.500.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
                self.location, meter, guest.arch, scratchdir=self.scratchdir,
194
194
                type=self.os_type, distro=distro)
195
195
 
196
 
            # Only set OS type if the user didn't explictly pass one
197
 
            # XXX: Should this be opt in?
198
 
            if guest.os_type == None and os_type:
199
 
                logging.debug("Auto detected OS type as: %s" % os_type)
200
 
                guest.os_type = os_type
201
 
            if (guest.os_variant == None and os_variant
202
 
                and guest.os_type == os_type):
203
 
                logging.debug("Auto detected OS variant as: %s" % os_variant)
204
 
                guest.os_variant = os_variant
 
196
            if guest.get_os_autodetect():
 
197
                if os_type:
 
198
                    logging.debug("Auto detected OS type as: %s" % os_type)
 
199
                    guest.os_type = os_type
 
200
 
 
201
                if (os_variant and guest.os_type == os_type):
 
202
                    logging.debug("Auto detected OS variant as: %s" %
 
203
                                  os_variant)
 
204
                    guest.os_variant = os_variant
205
205
 
206
206
            self.install["kernel"] = kernelfn
207
207
            self.install["initrd"] = initrdfn
227
227
 
228
228
    # General Installer methods
229
229
 
 
230
    def scratchdir_required(self):
 
231
        return bool(not self._location_is_path)
 
232
 
230
233
    def prepare(self, guest, meter, distro = None):
231
234
        self.cleanup()
232
235
 
262
265
            logging.exception("Error attempting to detect distro.")
263
266
            return (None, None)
264
267
 
265
 
        # Verify these are valid values
 
268
        # detectMediaDistro should only return valid values
266
269
        dtype, dvariant = dist_info
267
 
        import osdict
268
 
 
269
 
        if dtype and osdict.OS_TYPES.has_key(dtype):
270
 
            if not (dvariant and
271
 
                    osdict.OS_TYPES[dtype]["variants"].has_key(dvariant)):
272
 
                logging.debug("Variant returned from detect_distro is not "
273
 
                              "valid: %s" % dvariant)
274
 
                dvariant = None
275
 
        else:
276
 
            logging.debug("Type returned from detect_distro is not valid: %s"
277
 
                          % dtype)
278
 
            dtype = None
279
 
            dvariant = None
280
 
 
281
270
        return (dtype, dvariant)