def roots(self): """List of found roots.""" if self._roots is None: self._roots = find_existing_installations(self._storage.devicetree) if not self._roots: self.status = RescueModeStatus.ROOT_NOT_FOUND return self._roots
def input(self, args, key): """Override any input so we can launch rescue mode.""" try: keyid = int(key) - 1 except ValueError: pass if keyid == 3: # quit/reboot d = YesNoDialog(self.app, _(self.app.quit_message)) self.app.switch_screen_modal(d) if d.answer: iutil.execWithRedirect("systemctl", ["--no-wall", "reboot"]) elif keyid == 2: # skip to/run shell run_shell() elif (keyid == 1 or keyid == 0): # user chose 0 (continue/rw-mount) or 1 (ro-mount) # decrypt any luks devices self._unlock_devices() # this sleep may look pointless, but it seems necessary, in # order for some task to complete; otherwise no existing # installations are discovered. IOW, this is a hack. time.sleep(2) # attempt to find previous installations roots = find_existing_installations(self.storage.devicetree) if len(roots) == 1: self._root = roots[0] elif len(roots) > 1: # have to prompt user for which root to mount rootspoke = RootSpoke(self.app, self.data, self.storage, self.payload, self.instclass, roots) self.app.switch_screen_modal(rootspoke) self._root = rootspoke.root # if only one root detected, or user has chosen which root # to mount, go ahead and do that newspoke = RescueMountSpoke(self.app, self.data, self.storage, self.payload, self.instclass, keyid, self._root) self.app.switch_screen_modal(newspoke) self.close() else: # user entered some invalid number choice return key return INPUT_PROCESSED