コード例 #1
0
 def getDetails(self):
     # sometimes this is due to no NICs being detected.  In that case
     # getDetails will return a friendly, verbose message
     try:
         import networking
         networking.init()
         pnics = networking.getPhysicalNics()
         # GUI has its own way to handle this prettily
         notGUI = userchoices.getRunMode() != userchoices.RUNMODE_GUI
         if len(pnics) == 0 and notGUI:
             paras = NO_NIC_MSG.split('\n')
             paras = ['\n'.join(textwrap.wrap(x, 70)) for x in paras]
             return '\n'.join(paras)
     except (Exception, networking.HostCtlException), ex:
         pass
コード例 #2
0
ファイル: customdrivers.py プロジェクト: vmware/weasel
    def getDetails(self):
        # sometimes this is due to no NICs being detected.  In that case
        # getDetails will return a friendly, verbose message
        try:
            import networking

            networking.init()
            pnics = networking.getPhysicalNics()
            # GUI has its own way to handle this prettily
            notGUI = userchoices.getRunMode() != userchoices.RUNMODE_GUI
            if len(pnics) == 0 and notGUI:
                paras = NO_NIC_MSG.split("\n")
                paras = ["\n".join(textwrap.wrap(x, 70)) for x in paras]
                return "\n".join(paras)
        except (Exception, networking.HostCtlException), ex:
            pass
コード例 #3
0
def init():
    import userchoices
    if userchoices.getRunMode() == userchoices.RUNMODE_GUI:
        NextButtonCausesLoadingOfCodeChanges()
コード例 #4
0
def main(argv):
    try:
        timedate.checkActionSaneTimedate()

        parseArgsToUserChoices(argv)

        if userchoices.getDebug():
            # Only import debugging if specified
            # We want to ensure that the debugging module has minimal impact
            # because debug mode is not a supported installation method
            import debugging
            debugging.init()
            patchLocChoice = userchoices.getDebugPatchLocation()
            if patchLocChoice:
                log.info('using the super-secret live install patching')
                patchLoc = patchLocChoice['debugPatchLocation']
                debugging.livePatch(patchLoc)

        if userchoices.getShowInstallMethod():
            # User wants to select the media themselves.  So, we unmount the
            # media set up by the init scripts since the UI will remount it
            # later.
            util.umount(MEDIA_DEVICE_MOUNT_POINT)

        runModeChoice = userchoices.getRunMode()

        # if we didn't boot via CD, make sure we prompt for the media
        if runModeChoice != userchoices.RUNMODE_SCRIPTED and \
           not os.path.exists(
              os.path.join(MEDIA_DEVICE_MOUNT_POINT, 'packages.xml')) and \
           not userchoices.getMediaLocation():
            userchoices.setShowInstallMethod(True)

        if not runModeChoice:
            log.warn("User has not chosen a Weasel run mode.")
            log.info("Weasel run mode defaulting to GUI.")
            runMode = userchoices.RUNMODE_GUI
        else:
            runMode = runModeChoice['runMode']

        if runMode != userchoices.RUNMODE_GUI:
            switchTty()

        stdoutHandler.setLevel(logging.DEBUG)
        if runMode == userchoices.RUNMODE_GUI:
            startGui = True

            if userchoices.getStartX():
                import startx
                startGui = startx.startX(userchoices.getVideoDriver())

            if startGui:
                try:
                    import gui
                    gui.Gui()
                except RuntimeError, msg:
                    # gtk looks like it's having problems
                    import pciidlib
                    devs = pciidlib.PciDeviceSet()
                    devs.scanSystem(pciidlib.PCI_CLASS_VIDEO)

                    if len(devs) < 1:
                        log.warn("Didn't find a video chipset")
                    else:
                        log.warn("X failed for chipset %s" % devs.keys()[0])
                    startGui = False

            if not startGui:
                switchTty()

                from textui.main import TextUI
                t = TextUI([])
                t.run()

        elif runMode == userchoices.RUNMODE_TEXT:
            from textui.main import TextUI

            t = TextUI([])
            t.run()
コード例 #5
0
ファイル: weasel.py プロジェクト: vmware/weasel
def main(argv):
    try:
        timedate.checkActionSaneTimedate()
    
        parseArgsToUserChoices(argv)

        if userchoices.getDebug():
            # Only import debugging if specified 
            # We want to ensure that the debugging module has minimal impact
            # because debug mode is not a supported installation method
            import debugging
            debugging.init()
            patchLocChoice = userchoices.getDebugPatchLocation()
            if patchLocChoice:
                log.info('using the super-secret live install patching')
                patchLoc = patchLocChoice['debugPatchLocation']
                debugging.livePatch(patchLoc)

        if userchoices.getShowInstallMethod():
            # User wants to select the media themselves.  So, we unmount the
            # media set up by the init scripts since the UI will remount it
            # later.
            util.umount(MEDIA_DEVICE_MOUNT_POINT)
        
        runModeChoice = userchoices.getRunMode()

        # if we didn't boot via CD, make sure we prompt for the media
        if runModeChoice != userchoices.RUNMODE_SCRIPTED and \
           not os.path.exists(
              os.path.join(MEDIA_DEVICE_MOUNT_POINT, 'packages.xml')) and \
           not userchoices.getMediaLocation():
            userchoices.setShowInstallMethod(True)

        if not runModeChoice:
            log.warn("User has not chosen a Weasel run mode.")
            log.info("Weasel run mode defaulting to GUI.")
            runMode = userchoices.RUNMODE_GUI
        else:
            runMode = runModeChoice['runMode']

        if runMode != userchoices.RUNMODE_GUI:
            switchTty()

        stdoutHandler.setLevel(logging.DEBUG)
        if runMode == userchoices.RUNMODE_GUI:
            startGui = True

            if userchoices.getStartX():
                import startx
                startGui = startx.startX(userchoices.getVideoDriver())

            if startGui:
                try:
                    import gui
                    gui.Gui()
                except RuntimeError, msg:
                    # gtk looks like it's having problems
                    import pciidlib
                    devs = pciidlib.PciDeviceSet()
                    devs.scanSystem(pciidlib.PCI_CLASS_VIDEO)

                    if len(devs) < 1:
                        log.warn("Didn't find a video chipset")
                    else:
                        log.warn("X failed for chipset %s" % 
                            devs.keys()[0])
                    startGui = False

            if not startGui:
                switchTty()

                from textui.main import TextUI
                t = TextUI([])
                t.run()

        elif runMode == userchoices.RUNMODE_TEXT:
            from textui.main import TextUI

            t = TextUI([])
            t.run()
コード例 #6
0
ファイル: debugging.py プロジェクト: vmware/weasel
def init():
    import userchoices
    if userchoices.getRunMode() == userchoices.RUNMODE_GUI:
        NextButtonCausesLoadingOfCodeChanges()