# do this early so we can set flags before initializing logging from pyanaconda.flags import flags (opts, depr) = parse_arguments(boot_cmdline=flags.cmdline) from pyanaconda.core.configuration.anaconda import conf conf.set_from_opts(opts) # Set up logging as early as possible. from pyanaconda import anaconda_logging from pyanaconda import anaconda_loggers anaconda_logging.init(write_to_journal=conf.target.is_hardware) anaconda_logging.logger.setupVirtio(opts.virtiolog) # Load the product configuration after a logging is set up. conf.set_from_product(opts.product_name, opts.variant_name) conf.set_from_opts(opts) log = anaconda_loggers.get_main_logger() stdout_log = anaconda_loggers.get_stdout_logger() if os.geteuid() != 0: stdout_log.error("anaconda must be run as root.") sys.exit(1) # check if input kickstart should be saved if flags.nosave_input_ks: log.warning("Input kickstart will not be saved to the installed system due to the nosave option.") util.touch('/tmp/NOSAVE_INPUT_KS') # check if logs should be saved
def __init__(self, gui_mode): """Initialize the Initial Setup internals""" log.debug("initializing Initial Setup") # True if running in graphical mode, False otherwise (text mode) self.gui_mode = gui_mode # kickstart data self.data = None # reboot on quit flag self._reboot_on_quit = False # parse any command line arguments args = self._parse_arguments() # initialize logging initial_setup_log.init(stdout_log=not args.no_stdout_log) global logging_initialized logging_initialized = True log.info("Initial Setup %s" % __version__) # check if we are running as root if os.geteuid() != 0: log.critical("Initial Setup needs to be run as root") raise InitialSetupError # load configuration files from pyanaconda.core.configuration.base import ConfigurationError from pyanaconda.core.configuration.anaconda import conf try: conf.set_from_product(get_product_name()) except ConfigurationError as e: log.warning(str(e)) conf.set_from_files(["/etc/initial-setup/conf.d/"]) if self.gui_mode: log.debug("running in GUI mode") else: log.debug("running in TUI mode") self._external_reconfig = False # check if the reconfig mode should be enabled # by checking if at least one of the reconfig # files exist for reconfig_file in RECONFIG_FILES: if os.path.exists(reconfig_file): self.external_reconfig = True log.debug("reconfig trigger file found: %s", reconfig_file) if self.external_reconfig: log.debug("running in externally triggered reconfig mode") if self.gui_mode: # We need this so we can tell GI to look for overrides objects # also in anaconda source directories import gi.overrides for p in os.environ.get("ANACONDA_WIDGETS_OVERRIDES", "").split(":"): gi.overrides.__path__.insert(0, p) log.debug("GI overrides imported") from pyanaconda.ui.lib.addons import collect_addon_ui_paths addon_paths = [ "/usr/share/initial-setup/modules", "/usr/share/anaconda/addons" ] # append ADDON_PATHS dirs at the end sys.path.extend(addon_paths) self._addon_module_paths = collect_addon_ui_paths( addon_paths, self.gui_mode_id) log.info("found %d addon modules:", len(self._addon_module_paths)) for addon_path in self._addon_module_paths: log.debug(addon_path) # Too bad anaconda does not have modularized logging log.debug("initializing the Anaconda log") from pyanaconda import anaconda_logging anaconda_logging.init(write_to_journal=True) # create class for launching our dbus session self._dbus_launcher = AnacondaDBusLauncher() # group, user, root password set-before tracking self._groups_already_configured = False self._users_already_configured = False self._root_password_already_configured = False
# do this early so we can set flags before initializing logging from pyanaconda.flags import flags from pyanaconda.core.kernel import kernel_arguments (opts, depr) = parse_arguments(boot_cmdline=kernel_arguments) from pyanaconda.core.configuration.anaconda import conf conf.set_from_opts(opts) # Set up logging as early as possible. from pyanaconda import anaconda_logging from pyanaconda import anaconda_loggers anaconda_logging.init(write_to_journal=conf.target.is_hardware) anaconda_logging.logger.setupVirtio(opts.virtiolog) # Load the remaining configuration after a logging is set up. conf.set_from_product(opts.product_name, opts.variant_name) conf.set_from_files() conf.set_from_opts(opts) log = anaconda_loggers.get_main_logger() stdout_log = anaconda_loggers.get_stdout_logger() if os.geteuid() != 0: stdout_log.error("anaconda must be run as root.") sys.exit(1) # check if input kickstart should be saved if flags.nosave_input_ks: log.warning("Input kickstart will not be saved to the installed system due to the nosave option.") util.touch('/tmp/NOSAVE_INPUT_KS')
removed_no_inst_args) = parse_arguments(boot_cmdline=kernel_arguments) from pyanaconda.core.configuration.anaconda import conf conf.set_from_opts(opts) # Set up logging as early as possible. from pyanaconda import anaconda_logging from pyanaconda import anaconda_loggers anaconda_logging.init(write_to_journal=conf.target.is_hardware) anaconda_logging.logger.setupVirtio(opts.virtiolog) # Load the remaining configuration after a logging is set up. from pyanaconda import product conf.set_from_product(requested_product=opts.product_name, requested_variant=opts.variant_name, buildstamp_product=product.productName, buildstamp_variant=product.productVariant, default_product=util.get_os_release_value("NAME")) conf.set_from_files() conf.set_from_opts(opts) log = anaconda_loggers.get_main_logger() stdout_log = anaconda_loggers.get_stdout_logger() if os.geteuid() != 0: stdout_log.error("anaconda must be run as root.") sys.exit(1) # check if input kickstart should be saved if flags.nosave_input_ks: