Exemplo n.º 1
0
    def start(self, auto_process=False):
        self.status = None
        self.db = DebconfCommunicator(PACKAGE, cloexec=True)
        prep = self.prepare()
        self.command = prep[0]
        question_patterns = prep[1]
        if len(prep) > 2:
            env = prep[2]
        else:
            env = {}

        self.ui_loop_level = 0

        self.debug("Starting up '%s' for %s.%s", self.command,
                   self.__class__.__module__, self.__class__.__name__)
        self.debug("Watching for question patterns %s",
                   ', '.join(question_patterns))

        widgets = {}
        for pattern in question_patterns:
            widgets[pattern] = self
        self.dbfilter = DebconfFilter(self.db, widgets)

        # TODO: Set as unseen all questions that we're going to ask.

        self.dbfilter.start(self.command, blocking=False, extra_env=env)
        # Clearly, this isn't enough for full non-blocking operation.
        # However, debconf itself is generally quick, and the confmodule
        # will generally be listening for a reply when we try to send one;
        # the slow bit is waiting for the confmodule to decide to send a
        # command. Therefore, this is the only file descriptor we bother to
        # watch, which greatly simplifies our life.
        self.frontend.watch_debconf_fd(self.dbfilter.subout_fd,
                                       self.process_input)
Exemplo n.º 2
0
    def __init__(self):
        # Load preseed file
        if os.path.exists(DEFAULT_PRESEED_FILE):
            os.system("debconf-set-selections " + DEFAULT_PRESEED_FILE)

        db = DebconfCommunicator("ubiquity")

        self.BREADCRUMB_STEPS_PRESEED = {
            "stepLanguage":
            db.exist("ubiquity/stepLanguage") == "true"
            and db.get("ubiquity/stepLanguage") == "true",
            "stepLocation":
            db.exist("ubiquity/stepLocation") == "true"
            and db.get("ubiquity/stepLocation") == "true",
            "stepKeyboardConf":
            db.exist("ubiquity/stepKeyboardConf") == "true"
            and db.get("ubiquity/stepKeyboardConf") == "true",
            "stepUserInfo":
            db.exist("ubiquity/stepUserInfo") == "true"
            and db.get("ubiquity/stepUserInfo") == "true",
            "stepPartDisk":
            db.exist("ubiquity/stepPartDisk") == "true"
            and db.get("ubiquity/stepPartDisk") == "true",
            "stepPartAuto":
            db.exist("ubiquity/stepPartAuto") == "true"
            and db.get("ubiquity/stepPartAuto") == "true",
            "stepPartAdvanced":
            db.exist("ubiquity/stepPartAdvanced") == "true"
            and db.get("ubiquity/stepPartAdvanced") == "true",
            "stepPartMountpoints":
            db.exist("ubiquity/stepMountpoints") == "true"
            and db.get("ubiquity/stepMountpoints") == "true",
            "stepReady":
            db.exist("ubiquity/stepReady") == "true"
            and db.get("ubiquity/stepReady") == "true"
        }
        db.shutdown()
        self.BREADCRUMB_STEPS = {
            "stepLanguage": 1,
            "stepLocation": 2,
            "stepKeyboardConf": 3,
            "stepUserInfo": 4,
            "stepPartDisk": 5,
            "stepPartAuto": 5,
            "stepPartAdvanced": 5,
            "stepPartMountpoints": 5,
            "stepReady": 6
        }
Exemplo n.º 3
0
 def debconf_communicator(self):
     return DebconfCommunicator('oem-config', cloexec=True)