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.anaconda import conf 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.addons import collect_addon_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_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
from pyanaconda.addons import collect_addon_paths from pyanaconda.core import util, constants from pyanaconda import startup_utils # 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 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
from pyanaconda import iutil from pyanaconda import startup_utils # do this early so we can set flags before initializing logging from pyanaconda.flags import flags, can_touch_runtime_system (opts, depr) = parse_arguments(boot_cmdline=flags.cmdline) if opts.images: flags.imageInstall = True elif opts.dirinstall: flags.dirInstall = True # Set up logging as early as possible. from pyanaconda import anaconda_logging from pyanaconda import anaconda_loggers anaconda_logging.init() anaconda_logging.logger.setupVirtio() from pyanaconda import network network.setup_ifcfg_log() 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.")
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 # 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 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.addons import collect_addon_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_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() # init threading before Gtk can do anything and before we start using threads # initThreading initializes the threadMgr instance, import it afterwards log.debug("initializing threading") from pyanaconda.threading import initThreading initThreading() # initialize network logging (needed by the Network spoke that may be shown) log.debug("initializing network logging") from pyanaconda.network import setup_ifcfg_log setup_ifcfg_log() # create class for launching our dbus session self._dbus_launcher = DBusLauncher()
from pyanaconda.addons import collect_addon_paths from pyanaconda.core import util, constants from pyanaconda import startup_utils # 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) from pyanaconda import network network.setup_ifcfg_log() 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.")
# do this early so we can set flags before initializing logging from pyanaconda.flags import flags, can_touch_runtime_system (opts, depr) = parse_arguments(boot_cmdline=flags.cmdline) from pyanaconda.core.configuration.anaconda import conf conf.set_from_opts(opts) if opts.images: flags.imageInstall = True elif opts.dirinstall: flags.dirInstall = True # Set up logging as early as possible. from pyanaconda import anaconda_logging from pyanaconda import anaconda_loggers anaconda_logging.init( write_to_journal=not flags.imageInstall and not flags.dirInstall) anaconda_logging.logger.setupVirtio(opts.virtiolog) from pyanaconda import network network.setup_ifcfg_log() 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(