from pyanaconda import anaconda_log anaconda_log.init() from pyanaconda.installclass import DefaultInstall from pyanaconda.storage import Storage from pyanaconda.threads import initThreading from pyanaconda.packaging.yumpayload import YumPayload from pyanaconda.platform import getPlatform from pykickstart.version import makeVersion # Don't worry with fcoe, iscsi, dasd, any of that crud. from pyanaconda.flags import flags flags.imageInstall = True flags.testing = True initThreading() # Figure out the part we are about to show: hub/spoke? # And get the name of the module which represents it if os.path.basename(sys.argv[0]) == "run-spoke.py": spokeModuleName = "pyanaconda.ui.gui.spokes.%s" % sys.argv[1] from pyanaconda.ui.common import Spoke spokeBaseClass = Spoke spokeText = "spoke" SpokeText = "Spoke" elif os.path.basename(sys.argv[0]) == "run-hub.py": spokeModuleName = "pyanaconda.ui.gui.hubs.%s" % sys.argv[1] from pyanaconda.ui.common import Hub spokeBaseClass = Hub spokeText = "hub" SpokeText = "Hub"
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) 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") if 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_log anaconda_log.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.threads 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()
# 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 setupPythonUpdates() setupPythonPath() # init threading before Gtk can do anything and before we start using threads # initThreading initializes the threadMgr instance, import it afterwards from pyanaconda.threads import initThreading, AnacondaThread initThreading() from pyanaconda.threads import threadMgr from pyanaconda.i18n import _ from pyanaconda import constants from pyanaconda.addons import collect_addon_paths from pyanaconda import geoloc from pyanaconda import iutil # do this early so we can set flags before initializing logging from pyanaconda.flags import flags, can_touch_runtime_system (opts, depr) = parseArguments(boot_cmdline=flags.cmdline) if opts.images: flags.imageInstall = True
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) 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") if 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_log anaconda_log.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.threads 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()