コード例 #1
0
ファイル: review.py プロジェクト: vmware-archive/weasel
def reviewInstallationSource(values):
    try:
        location = userchoices.getMediaLocation()
        if not location:
            media = userchoices.getMediaDescriptor()
            if media:
                values['mediaDrive'] = htmlEscape(media.getName())
                values['mediaVersion'] = htmlEscape(media.version)
                if media.isoPath:
                    values['isoPath'] = htmlEscape(media.isoPath)
                    values['mediaISO'] = (
                        '%(subKeyStart)sISO:%(subKeyEnd)s'
                        '%(ralign)s%(isoPath)s<br/>' % values)
                else:
                    values['mediaISO'] = ''
                values['mediaTemplate'] = DRIVE_MEDIA % values
            else:
                values['mediaLocation'] = 'DVD-ROM'
                values['mediaTemplate'] = BASIC_MEDIA % values
        else:
            rawLocation = location['mediaLocation']
            values['mediaLocation'] = htmlEscape(
                networking.utils.cookPasswordInFileResourceURL(rawLocation))
            values['mediaTemplate'] = BASIC_MEDIA % values
    except KeyError:
        values['mediaTemplate'] = ''
コード例 #2
0
ファイル: usbmedia_gui.py プロジェクト: vmware-archive/weasel
    def rescanMedia(self, *_args):
        """Do a scan for any attached installation media."""
        selectedMedia = userchoices.getMediaDescriptor()
        
        self.mediaFound = (cdutil.findCdMedia(showAll=True) +
                           usbmedia.findUSBMedia(showAll=True))

        self.model.clear()
        for installMedia in self.mediaFound:
            foreground = "#000000"
            if not installMedia.hasPackages:
                # Mark devices without media as red.  We do not want to make
                # them insensitive since the user needs to be able to select
                # the device they want to eject.
                contents = "No packages"
                foreground = "#ff0000"
            elif installMedia.isoPath:
                contents = installMedia.isoPath
            else:
                contents = "Installation packages"
            mediaIter = self.model.append(None, [
                    util.truncateString(installMedia.getName(),
                                        DEVMODEL_LENGTH),
                    contents,
                    installMedia.version,
                    installMedia,
                    foreground])
            if installMedia.hasPackages and \
                    (not selectedMedia or
                     selectedMedia.diskName == installMedia.diskName):
                self.view.set_cursor(self.model.get_path(mediaIter))
                selectedMedia = installMedia
コード例 #3
0
ファイル: media.py プロジェクト: vmware-archive/weasel
def runtimeActionEjectMedia():
    if userchoices.getMediaLocation():
        # Non-CD install, don't bother.
        return
    
    if userchoices.getNoEject():
        return

    media = userchoices.getMediaDescriptor() or DEFAULT_MEDIA
    return media.eject()
コード例 #4
0
ファイル: scriptwriter.py プロジェクト: vmware/weasel
def _genInstall():
    devChoice = userchoices.getMediaDescriptor()
    urlChoice = userchoices.getMediaLocation()

    if not urlChoice and not devChoice:
        return "install cdrom\n"

    if devChoice:
        if devChoice.partPath in cdutil.cdromDevicePaths():
            return "install cdrom\n"
        else:
            return "install usb\n"
        
    # XXX proxy not handled...
    return "install url %s\n" % urlChoice['mediaLocation']
コード例 #5
0
ファイル: scriptwriter.py プロジェクト: vmware-archive/weasel
def _genInstall():
    devChoice = userchoices.getMediaDescriptor()
    urlChoice = userchoices.getMediaLocation()

    if not urlChoice and not devChoice:
        return "install cdrom\n"

    if devChoice:
        if devChoice.partPath in cdutil.cdromDevicePaths():
            return "install cdrom\n"
        else:
            return "install usb\n"

    # XXX proxy not handled...
    return "install url %s\n" % urlChoice['mediaLocation']
コード例 #6
0
ファイル: media.py プロジェクト: vmware-archive/weasel
def runtimeActionMountMedia(uiDelegate=None):
    """Mounts the installation media."""

    if not uiDelegate:
        uiDelegate = MOUNT_MEDIA_DELEGATE

    log.info("attempting to mount install media")

    if userchoices.getMediaLocation():
        log.info("  remote media in use, nothing to mount...")
        return

    while True:
        media = userchoices.getMediaDescriptor()

        if not media:
            # Check for the default media setup by the init scripts.
            media = DEFAULT_MEDIA
            media.isMounted = isInstallMediaMounted()
            if not os.path.exists(media.partPath):
                # attempt to remount the cd-rom since it may have been a SCSI
                # CD-ROM drive
                rc, stdout, stderr = \
                    execCommand("cd / && INSTALLER=1 %s %s" % (INIT_WRAPPER,
                                CDROM_MOUNT_SCRIPT))
                if rc:
                    log.critical("%s was not created" % media.partPath)
                    uiDelegate.mountMediaNoDrive()
                    sys.exit(ExitCodes.IMMEDIATELY_REBOOT)
                else:
                    media.isMounted = True

        # Make sure the media is mounted up.
        try:
            media.mount()
            if isInstallMediaMounted():
                return
            media.umount()
        except Exception, e:
            log.error(str(e))
        media.eject()
        uiDelegate.mountMediaNoPackages()
コード例 #7
0
ファイル: media.py プロジェクト: vmware-archive/weasel
def runtimeActionMediaCheck(uiDelegate=None):
    global MEDIA_CHECKED
    
    log.info("checking the MD5 of the installation media")

    if not uiDelegate:
        uiDelegate = MOUNT_MEDIA_DELEGATE

    media = userchoices.getMediaDescriptor() or DEFAULT_MEDIA

    def verify():
        try:
            d1, d2, _id = brandiso.extract_iso_checksums(media.partPath)
            return d1 == d2
        except brandiso.BrandISOException, inst:
            log.warn(inst)
            return None
        except IOError, e:
            log.warn(e)
            return None
コード例 #8
0
ファイル: media.py プロジェクト: vmware-archive/weasel
def runtimeActionUnmountMedia():
    if userchoices.getMediaLocation():
        return
    
    media = userchoices.getMediaDescriptor() or DEFAULT_MEDIA
    media.umount()
コード例 #9
0
ファイル: usbmedia_gui.py プロジェクト: vmware-archive/weasel
 def getBack(self):
     """Mark the media drive as not in-use anymore."""
     selectedMedia = userchoices.getMediaDescriptor()
     if selectedMedia and selectedMedia.diskName:
         userchoices.delDriveUse(selectedMedia.diskName, 'media')