def __init__(self, distro): """Frontend initialisation.""" self.distro = distro self.dbfilter = None self.dbfilter_status = None self.resize_choice = None self.manual_choice = None self.summary_device = None self.grub_en = None self.popcon = None self.locale = None self.http_proxy_host = None self.http_proxy_port = 8080 # Drop privileges so we can run the frontend as a regular user, and # thus talk to a11y applications running as a regular user. drop_privileges() # Use a single private debconf-communicate instance for several # queries we need to make at startup. While this is less convenient # than using debconf_operation, it's significantly faster. db = self.debconf_communicator() self.oem_config = False try: if db.get('oem-config/enable') == 'true': self.oem_config = True # It seems unlikely that anyone will need # migration-assistant in the OEM installation process. If it # turns out that they do, just delete the following two # lines. if 'UBIQUITY_MIGRATION_ASSISTANT' in os.environ: del os.environ['UBIQUITY_MIGRATION_ASSISTANT'] except debconf.DebconfError: pass self.oem_user_config = False if 'UBIQUITY_OEM_USER_CONFIG' in os.environ: self.oem_user_config = True if self.oem_config: try: db.set('passwd/auto-login', 'true') db.set('passwd/auto-login-backup', 'oem') except debconf.DebconfError: pass # set commands # Note that this will never work if the database is locked, so you # cannot trap that particular error using failure_command. self.automation_error_cmd = None self.error_cmd = None self.success_cmd = None try: self.automation_error_cmd = db.get( 'ubiquity/automation_failure_command') self.error_cmd = db.get('ubiquity/failure_command') self.success_cmd = db.get('ubiquity/success_command') except debconf.DebconfError: pass self.allow_password_empty = False try: self.allow_password_empty = db.get('user-setup/allow-password-empty') == 'true' except debconf.DebconfError: pass # These step lists are the steps that aren't yet converted to plugins. # We just hardcode them here, but they will eventually be dynamic. if self.oem_user_config: steps = ['UserInfo'] else: use_raid = db.get('ubiquity/use_raid') if use_raid == "true": steps = ['UserInfo', 'MigrationAssistant', 'Ready'] else: steps = ['Partman', 'UserInfo', 'MigrationAssistant', 'Ready'] modules = [] for step in steps: if step == 'MigrationAssistant' and \ 'UBIQUITY_MIGRATION_ASSISTANT' not in os.environ: continue page_module = PAGE_COMPONENTS[step] if page_module is not None: modules.append(page_module) # Load plugins plugins = plugin_manager.load_plugins() modules = plugin_manager.order_plugins(plugins, modules) self.modules = [] for mod in modules: comp = Component() comp.module = mod if hasattr(mod, 'Page'): comp.filter_class = mod.Page self.modules.append(comp) if not self.modules: raise ValueError, 'No valid steps.' if 'SUDO_USER' in os.environ: os.environ['SCIM_USER'] = os.environ['SUDO_USER'] os.environ['SCIM_HOME'] = os.path.expanduser( '~%s' % os.environ['SUDO_USER']) db.shutdown()
def __init__(self, distro): """Frontend initialisation.""" self.distro = distro self.db = None self.dbfilter = None self.dbfilter_status = None self.resize_choice = None self.manual_choice = None self.locale = None self.wget_retcode = None self.wget_proc = None # Drop privileges so we can run the frontend as a regular user, and # thus talk to a11y applications running as a regular user. drop_privileges() self.start_debconf() self.oem_user_config = False if "UBIQUITY_OEM_USER_CONFIG" in os.environ: self.oem_user_config = True try: self.custom_title = self.db.get("ubiquity/custom_title_text") except debconf.DebconfError: self.custom_title = False self.oem_config = False if not self.oem_user_config: try: if self.db.get("oem-config/enable") == "true": self.oem_config = True # It seems unlikely that anyone will need # migration-assistant in the OEM installation process. If it # turns out that they do, just delete the following two # lines. if "UBIQUITY_MIGRATION_ASSISTANT" in os.environ: del os.environ["UBIQUITY_MIGRATION_ASSISTANT"] except debconf.DebconfError: pass if self.oem_config: try: self.db.set("passwd/auto-login", "true") self.db.set("passwd/auto-login-backup", "oem") except debconf.DebconfError: pass # set commands # Note that this will never work if the database is locked, so you # cannot trap that particular error using failure_command. self.automation_error_cmd = "" self.error_cmd = "" self.success_cmd = "" try: self.automation_error_cmd = self.db.get("ubiquity/automation_failure_command") self.error_cmd = self.db.get("ubiquity/failure_command") self.success_cmd = self.db.get("ubiquity/success_command") except debconf.DebconfError: pass try: self.show_shutdown_button = self.db.get("ubiquity/show_shutdown_button") == "true" except debconf.DebconfError: self.show_shutdown_button = False # Load plugins plugins = plugin_manager.load_plugins() modules = plugin_manager.order_plugins(plugins) self.modules = [] for mod in modules: if mod.NAME == "migrationassistant" and "UBIQUITY_MIGRATION_ASSISTANT" not in os.environ: continue comp = Component() comp.module = mod if hasattr(mod, "Page"): comp.filter_class = mod.Page self.modules.append(comp) if not self.modules: raise ValueError("No valid steps.") if "SUDO_USER" in os.environ: os.environ["SCIM_USER"] = os.environ["SUDO_USER"] os.environ["SCIM_HOME"] = os.path.expanduser("~%s" % os.environ["SUDO_USER"])
def __init__(self, distro): """Frontend initialisation.""" self.distro = distro self.db = None self.dbfilter = None self.dbfilter_status = None self.resize_choice = None self.manual_choice = None self.locale = None self.wget_retcode = None self.wget_proc = None # Drop privileges so we can run the frontend as a regular user, and # thus talk to a11y applications running as a regular user. drop_privileges() self.start_debconf() self.oem_user_config = False if 'UBIQUITY_OEM_USER_CONFIG' in os.environ: self.oem_user_config = True try: self.custom_title = self.db.get('ubiquity/custom_title_text') except debconf.DebconfError: self.custom_title = False self.oem_config = False if not self.oem_user_config: try: if self.db.get('oem-config/enable') == 'true': self.oem_config = True except debconf.DebconfError: pass if self.oem_config: try: self.db.set('passwd/auto-login', 'true') self.db.set('passwd/auto-login-backup', 'oem') except debconf.DebconfError: pass # set commands # Note that this will never work if the database is locked, so you # cannot trap that particular error using failure_command. self.automation_error_cmd = '' self.error_cmd = '' self.success_cmd = '' try: self.automation_error_cmd = self.db.get( 'ubiquity/automation_failure_command') self.error_cmd = self.db.get('ubiquity/failure_command') self.success_cmd = self.db.get('ubiquity/success_command') except debconf.DebconfError: pass try: self.show_shutdown_button = \ self.db.get('ubiquity/show_shutdown_button') == 'true' except debconf.DebconfError: self.show_shutdown_button = False self.hide_slideshow = False try: if self.db.get('ubiquity/hide_slideshow') == 'true': self.hide_slideshow = True except debconf.DebconfError: pass # Load plugins plugins = plugin_manager.load_plugins() modules = plugin_manager.order_plugins(plugins) self.modules = [] for mod in modules: comp = Component() comp.module = mod if hasattr(mod, 'Page'): comp.filter_class = mod.Page self.modules.append(comp) if not self.modules: raise ValueError('No valid steps.') if 'SUDO_USER' in os.environ: os.environ['SCIM_USER'] = os.environ['SUDO_USER'] os.environ['SCIM_HOME'] = os.path.expanduser( '~%s' % os.environ['SUDO_USER'])
def __init__(self, distro): """Frontend initialisation.""" self.distro = distro self.db = None self.dbfilter = None self.dbfilter_status = None self.resize_choice = None self.manual_choice = None self.grub_en = None self.popcon = None self.locale = None self.http_proxy_host = None self.http_proxy_port = 8080 # Drop privileges so we can run the frontend as a regular user, and # thus talk to a11y applications running as a regular user. drop_privileges() self.start_debconf() self.oem_user_config = False if 'UBIQUITY_OEM_USER_CONFIG' in os.environ: self.oem_user_config = True try: self.custom_title = self.db.get('ubiquity/custom_title_text') except debconf.DebconfError: self.custom_title = False self.oem_config = False if not self.oem_user_config: try: if self.db.get('oem-config/enable') == 'true': self.oem_config = True # It seems unlikely that anyone will need # migration-assistant in the OEM installation process. If it # turns out that they do, just delete the following two # lines. if 'UBIQUITY_MIGRATION_ASSISTANT' in os.environ: del os.environ['UBIQUITY_MIGRATION_ASSISTANT'] except debconf.DebconfError: pass if self.oem_config: try: self.db.set('passwd/auto-login', 'true') self.db.set('passwd/auto-login-backup', 'oem') except debconf.DebconfError: pass # set commands # Note that this will never work if the database is locked, so you # cannot trap that particular error using failure_command. self.automation_error_cmd = '' self.error_cmd = '' self.success_cmd = '' try: self.automation_error_cmd = self.db.get( 'ubiquity/automation_failure_command') self.error_cmd = self.db.get('ubiquity/failure_command') self.success_cmd = self.db.get('ubiquity/success_command') except debconf.DebconfError: pass # Load plugins plugins = plugin_manager.load_plugins() modules = plugin_manager.order_plugins(plugins) self.modules = [] for mod in modules: if mod.NAME == 'migrationassistant' and \ 'UBIQUITY_MIGRATION_ASSISTANT' not in os.environ: continue comp = Component() comp.module = mod if hasattr(mod, 'Page'): comp.filter_class = mod.Page self.modules.append(comp) if not self.modules: raise ValueError, 'No valid steps.' if 'SUDO_USER' in os.environ: os.environ['SCIM_USER'] = os.environ['SUDO_USER'] os.environ['SCIM_HOME'] = os.path.expanduser( '~%s' % os.environ['SUDO_USER'])
def __init__(self, distro): """Frontend initialisation.""" self.distro = distro self.db = None self.dbfilter = None self.dbfilter_status = None self.resize_choice = None self.manual_choice = None self.summary_device = None self.grub_en = None self.popcon = None self.locale = None self.http_proxy_host = None self.http_proxy_port = 8080 # Drop privileges so we can run the frontend as a regular user, and # thus talk to a11y applications running as a regular user. drop_privileges() self.start_debconf() self.oem_user_config = False if 'UBIQUITY_OEM_USER_CONFIG' in os.environ: self.oem_user_config = True self.oem_config = False if not self.oem_user_config: try: if self.db.get('oem-config/enable') == 'true': self.oem_config = True # It seems unlikely that anyone will need # migration-assistant in the OEM installation process. If it # turns out that they do, just delete the following two # lines. if 'UBIQUITY_MIGRATION_ASSISTANT' in os.environ: del os.environ['UBIQUITY_MIGRATION_ASSISTANT'] except debconf.DebconfError: pass if self.oem_config: try: self.db.set('passwd/auto-login', 'true') self.db.set('passwd/auto-login-backup', 'oem') except debconf.DebconfError: pass # set commands # Note that this will never work if the database is locked, so you # cannot trap that particular error using failure_command. self.automation_error_cmd = '' self.error_cmd = '' self.success_cmd = '' try: self.automation_error_cmd = self.db.get( 'ubiquity/automation_failure_command') self.error_cmd = self.db.get('ubiquity/failure_command') self.success_cmd = self.db.get('ubiquity/success_command') except debconf.DebconfError: pass # Load plugins plugins = plugin_manager.load_plugins() modules = plugin_manager.order_plugins(plugins) self.modules = [] for mod in modules: if mod.NAME == 'migrationassistant' and \ 'UBIQUITY_MIGRATION_ASSISTANT' not in os.environ: continue comp = Component() comp.module = mod if hasattr(mod, 'Page'): comp.filter_class = mod.Page self.modules.append(comp) if not self.modules: raise ValueError, 'No valid steps.' if 'SUDO_USER' in os.environ: os.environ['SCIM_USER'] = os.environ['SUDO_USER'] os.environ['SCIM_HOME'] = os.path.expanduser( '~%s' % os.environ['SUDO_USER'])