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()
# Allow a file to be loaded as early as possible try: # pylint: disable=import-error,unused-import import updates_disk_hook except ImportError: pass # this handles setting up updates for pypackages to minimize the set needed setup_python_updates() setup_python_path() # init threading before Gtk can do anything and before we start using threads # initThreading initializes the threadMgr instance, import it afterwards from pyanaconda.threading import initThreading, AnacondaThread initThreading() from pyanaconda.threading import threadMgr from pyanaconda.i18n import _ from pyanaconda import constants from pyanaconda.addons import collect_addon_paths 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
# Allow a file to be loaded as early as possible try: # pylint: disable=import-error,unused-import import updates_disk_hook except ImportError: pass # this handles setting up updates for pypackages to minimize the set needed setup_python_updates() setup_python_path() # init threading before Gtk can do anything and before we start using threads # initThreading initializes the threadMgr instance, import it afterwards from pyanaconda.threading import initThreading, AnacondaThread, threadMgr initThreading() from pyanaconda.core.i18n import _ 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.