403Webshell
Server IP : 88.99.149.37  /  Your IP : 216.73.216.141
Web Server : nginx/1.31.2
System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64
User : muralimurth ( 1015)
PHP Version : 8.4.23
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/1/cwd/usr/lib/python3.12/site-packages/dnf/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/1/cwd/usr/lib/python3.12/site-packages/dnf/__pycache__/util.cpython-312.opt-1.pyc
�

�jAb���ddlmZddlmZddlmZddlmZmZddlmZm	Z	ddl
Z
ddlZddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZej@d�Z!e
jD�jFd	k(re
jD�jFndZ$e$jK�Z&	d
�Z'd;d�Z(d<d�Z)d
�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d�Z3d�Z4d�Z5d�Z6d�Z7d�Z8d�Z9d�Z:d�Z;d�Z<d �Z=d!�Z>d"�Z?d#�Z@d$�ZAd%�ZBd&�ZCd=d'�ZDd(d)ej�fd*�ZFd+�ZGd,�ZHd-�ZId.�ZJGd/�d0eK�ZLGd1�d2eM�ZNGd3�d4eO�ZPd5�ZQd6�ZRd7�ZSd8�ZTGd9�d:�ZUy)>�)�print_function)�absolute_import)�unicode_literals�)�PY3�
basestring)�_�ucdN�dnf�yumc�,�t|dg�t|dg�t|dg�t�}|D]�}||vr�|j|�tjj
j|�d}|j
d�r|jj|��r|r |dvr|jj|���|jd�r|jj|dd	���|jj|���y	)
a�
    Categorize :param values list into packages, groups and filenames

    :param namespace: argparse.Namespace, where specs will be stored
    :param values: list of specs, whether packages ('foo') or groups/modules ('@bar')
                   or filenames ('*.rmp', 'http://*', ...)

    To access packages use: specs.pkg_specs,
    to access groups use: specs.grp_specs,
    to access filenames use: specs.filenames
    �	filenames�	grp_specs�	pkg_specsrz.rpm)�http�ftp�file�https�@rN)�setattr�set�addr�pycomp�urlparse�endswithr�append�
startswithrr)�	namespace�values�tmp_set�value�schemess     �-/usr/lib/python3.12/site-packages/dnf/util.py�_parse_specsr$9s����I�{�B�'��I�{�B�'��I�{�B�'��e�G����G������E���*�*�%�%�.�.�u�5�a�8���>�>�&�!����&�&�u�-�
��$D�D����&�&�u�-�
�
�
�c�
"����&�&�u�Q�R�y�1����&�&�u�-��c�\�|�tjj�}tjj	|||�}t|jg�}|jd|�|j�g}	tjjjtjj|�d�|j&S#t$rS}|jrtt!|���t"j%t!|��Yd}~|j&Sd}~wwxYw)NrT)r�callback�NullDownloadProgress�repo�RemoteRPMPayload�sum�
download_size�start�_librepo_target�libdnf�
PackageTarget�downloadPackages�VectorPPackageTarget�RuntimeError�strict�IOError�str�logger�error�
local_path)�url�conf�progress�pload�est_remote_size�targets�es       r#�_urlopen_progressrAYs������<�<�4�4�6���H�H�%�%�c�4��:�E��5�.�.�/�0�O��N�N�1�o�&��$�$�&�'�G�����!�!�2�2�6�;�;�3S�3S�T[�3\�^b�c�
�����	���;�;��#�a�&�/�!����S��V��������	�s�<AC�	D+�>D&�&D+c��trd|vr|jdd�tj|fi|��}	|r+|jj||j
��nGtjjj|r|jnd||j
��|jd�|S#t$r}tt|���d}~wwxYw)z|
    Open the specified absolute url, return a file object
    which respects proxy setting even for non-repo downloads
    �b�encodingzutf-8Nr)r�
setdefault�tempfile�NamedTemporaryFile�_repo�downloadUrl�filenor/r)�
Downloader�downloadURL�_configr3r5r6�seek)r:r;r)�mode�kwargs�for@s       r#�_urlopenrRhs���
�s�$�����*�g�.�	�	$�	$�T�	4�V�	4�B����J�J�"�"�3��	�	��4��K�K�"�"�.�.�t�t�|�|��s�TV�T]�T]�T_�`��G�G�A�J�
�I��	���c�!�f�o����s�A4B;�;	C�C�Cc�F�|j|�r|dt|�}|S�N)r�len)�s�rs  r#�rtrimrX|s#���z�z�!�}�
�h��A��w�K���Hr%c�0�tj�dk(S�Nr)�os�geteuid�r%r#�	am_i_rootr^�s��
�:�:�<�1��r%c��tj|�D]-}tjj||�}t	|��/y)zBRemove all files and dirs under `path`

    Also see rm_rf()

    N)r[�listdir�path�join�rm_rf)ra�entry�contained_paths   r#�	clear_dirrf�s3�����D�!�������d�E�2��
�n��"r%c���	tj|d��y#t$rH}|jtjk7stj
j
|�s|�Yd}~yd}~wwxYw)Ni�)rO)r[�makedirs�OSError�errno�EEXISTra�isdir)�dnamer@s  r#�
ensure_dirrn�sN���
���E��&�����7�7�e�l�l�"�"�'�'�-�-��*>��G�+?���s��	A+�>A&�&A+c��g}|}	tjj|�\}}|s|s|s|jd|�	|S|jd|��P)z`
    Split path by path separators.
    Use os.path.join() to join the path back to string.
    r)r[ra�split�insert)ra�result�head�tails    r#�
split_pathru�s\��
�F��D�
��W�W�]�]�4�(�
��d���6��
�
�a��&���M�	�
�
�a���r%c�r�	t|�}|dk(S#t$rtt|��}Y|dk(SwxYwrZ)rU�	TypeError�list)�iterable�ls  r#�emptyr{�sC�� ���M��
��6�M��� ���X������6�M� �s��6�6c�N�t|�}	t|�S#t$rYywxYw)zFReturns the first item from an iterable or None if it has no elements.N��iter�next�
StopIteration�ry�its  r#�firstr��s+��	
�h��B���B�x�������s�
�	$�$c�\�t|�}	td�|D��S#t$rYywxYw)Nc3�&K�|]	}|��|���y�wrTr])�.0�items  r#�	<genexpr>z!first_not_none.<locals>.<genexpr>�s����<�R�T�4�+;�D�R�s��r}r�s  r#�first_not_noner��s3��	
�h��B���<�R�<�<�<������s��	+�+c�B�tj�t|�z
SrT)�time�file_timestamp��fns r#�file_ager��s���9�9�;���+�+�+r%c�@�tj|�jSrT)r[�stat�st_mtimer�s r#r�r��s��
�7�7�2�;���r%c��	tjtj��dS#t$rdtj�zcYSwxYw)NrzUID: %s)�pwd�getpwuidr[r\�KeyErrorr]r%r#�get_effective_loginr��sA��(��|�|�B�J�J�L�)�!�,�,���(��2�:�:�<�'�'�(�s�),� A�Ac�B�|D]}|j|�}|��|cS|S)z!Like dict.get() for nested dicts.)�get)�dct�keys�	not_found�ks    r#�get_inr��s+��
���g�g�a�j���;�����Jr%c�@���fd�}tj||ggf�S)Nc�P��|t�|��j|�|SrT)�boolr)�accr�r�s  �r#�splitterz!group_by_filter.<locals>.splitter�s&�����R��X����&�&�t�,��
r%)�	functools�reduce)r�ryr�s`  r#�group_by_filterr��s#�������H�h��R��9�9r%c#�:K�|D]}||�r|��|���y�w)z/Insert an item into an iterable by a condition.Nr])r�ry�	condition�
original_items    r#�	insert_ifr��s#����!�
��]�#��J���"�s�c�:�	t|�y#t$rYywxYw)z&Test whether an iterator is exhausted.FT)rr�)�iterators r#�is_exhaustedr��s'����X��������s��	�c�f�t|�r|g}t|t�xrtd�|D��S)Nc3�JK�|]}t|�td�z���y�w)z*[?N)r)r��ps  r#r�z"is_glob_pattern.<locals>.<genexpr>�s����-S�7�a�c�!�f�s�5�z�.A�7�s�!#)�is_string_type�
isinstancerx�any)�patterns r#�is_glob_patternr��s.���g���)���w��%�S�#�-S�7�-S�*S�Tr%c�N�trt|t�St|t�SrT)rr�r6r)�objs r#r�r��s��
��#�s�#�#��#�z�*�*r%c����fd�}|S)z�Decorator to get lazy attribute initialization.

    Composes with @property. Force reinitialization by deleting the <attrname>.
    c������fd�}|S)Nc�j��	t|��S#t$r�|�}t|�|�|cYSwxYwrT)�getattr�AttributeErrorr)r��val�attrnamer�s  ��r#�
cached_getterz6lazyattr.<locals>.get_decorated.<locals>.cached_getters>���
��s�H�-�-��!�
���g����X�s�+��
�
�s�� 2�2r])r�r�r�s` �r#�
get_decoratedzlazyattr.<locals>.get_decorated�s���	��r%r])r�r�s` r#�lazyattrr��s���
��r%c�,�tt|g|����S)z�Like functools.map(), but return a list instead of an iterator.

    This means all side effects of fn take place even without iterating the
    result.

    �rx�map)r��seqs  r#�mapallr�s����B�
��
��r%c���tjdtj|��}tjj
s*t
j�d}|r|j|�}|S)z6Convert time into locale aware datetime string object.z%cr)	r��strftime�	localtimerrr�locale�	getlocale�decode)�	timestamp�t�current_locale_settings   r#�normalize_timer�sQ���
�
�d�D�N�N�9�5�6�A��:�:�>�>�!'�!1�!1�!3�A�!6��!����/�0�A��Hr%c�j�	d}tj|�D�cgc]}|jd�s�|��}}t|�dkDrH|d}t	dj||��5}|j
�}t|�dk(cddd�Sycc}w#1swYyxYw#ttf$rYywxYw)z�Decide whether we are on line power.

    Returns True if we are on line power, False if not, None if it can not be
    decided.

    z/sys/class/power_supply�ACrz{}/{}/onlinerN)
r[r`rrU�open�format�read�intr5�
ValueError)�	ps_folder�node�ac_nodes�ac_node�	ac_status�datas      r#�on_ac_powerr�s���
�-�	�%'�Z�Z�	�%:�T�%:�T�d�o�o�d�>S�D�%:��T��x�=�1���q�k�G��n�+�+�I�w�?�@�I� �~�~�'���4�y�A�~�A�@���
U�A����Z� ����sD�B �B�B�0B �&B�	B �B �B�B �B � B2�1B2c��	ddl}	|j�}|jdd�}|j	|d�}|jdd�}|dk(ry|dvry|d	vry
td|��#t$rYywxYw#|j$rYywxYw)z�Decide whether we are on metered connection.

    Returns:
      True: if on metered connection
      False: if not
      None: if it can not be decided
    rNzorg.freedesktop.NetworkManagerz/org/freedesktop/NetworkManagerzorg.freedesktop.DBus.Properties�Metered)r�T)��Fz&Unknown value for metered property: %r)�dbus�ImportError�	SystemBus�
get_object�	Interface�Get�
DBusExceptionr�)r��bus�proxy�iface�metereds     r#�on_metered_connectionr�1s�������n�n������?�@�B�����u�&G�H���)�)�<�i�H���!�|��	�F�	��	�F�	���A�7�K�K��#�����������s#�A)�AA8�)	A5�4A5�8B
�	B
c��tj|�\}}tjj	||�t||�fS)z�Use a predicate to partition entries into false entries and true entries.

    Credit: Python library itertools' documentation.

    )�	itertools�teerr�filterfalse�filter)�predry�t1�t2s    r#�	partitionr�Ns9���]�]�8�
$�F�B���:�:�!�!�$��+�V�D�"�-=�=�=r%c�N�	tj|�y#t$rYywxYwrT)�shutil�rmtreeri�ras r#rcrcWs%��
��
�
�d����
��
�s��	$�$c#�z�K�t���fd�}t�||�}||���	||�}|sy|����w)z�Split an iterable into tuples by a condition.

    Inserts a separator before each item which meets the condition and then
    cuts the iterable by these separators.

    c�H��ttj�fd�|��S)Nc���|�k7SrTr])r@�	separators �r#�<lambda>z4split_by.<locals>.next_subsequence.<locals>.<lambda>gs	���1�	�>r%)�tupler��	takewhile)r�rs �r#�next_subsequencez"split_by.<locals>.next_subsequencefs����Y�(�(�)A�2�F�G�Gr%N)�objectr�)ryr�r�marked�subsequencers     @r#�split_byr]sQ�������I�H��y�(�I�
6�F��6�
"�"�
�&�v�.������	�s�8;c�B�|j|�r|t|�dSyrT)rrU)rV�prefixs  r#�strip_prefixrus!���|�|�F����V�����r%c��|s$tj|tj�rtj|d�St	|d�5	ddd�y#1swYyxYw)z{Create an empty file if it doesn't exist or bump it's timestamps.

    If no_create is True only bumps the timestamps.
    N�a)r[�access�F_OK�utimer�)ra�	no_creates  r#�touchr{s?��
�B�I�I�d�B�G�G�,��x�x��d�#�#�	
�d�C���
���s�	A�A�write�c	��	|dk(r|j|�y|dk(r|j�y|dk(r"|j|�|j�y|dk(rt||��ytd|z��#t$rK}t
j
djt|�jt|���Yd}~yd}~wwxYw)Nr�flush�write_flush�print)rzUnsupported type: z{}: {})rrrr�r5r7�criticalr��type�__name__r
)�tp�msg�outr@s    r#�_terminal_messengerr�s���
�
��=��I�I�c�N�
�7�]��I�I�K�
�=�
 ��I�I�c�N��I�I�K�
�7�]��#�C� ��1�B�6�7�7���
��������Q��(8�(8�#�a�&�A�B���
�s.�A7�A7�&A7�A7�)A7�7	C�AC�Cc���d}t|�dkD}t|d��D]G\}}|r|dtd�zd|zzz
}n|dtd�zdzz
}|dj|�z
}�I|S)	z�
    Format string about problems in resolve

    :param resolve_problems: list with list of strings (output of goal.problem_rules())
    :return: string
    rr)r-z
 �Problemz %d: z: z
  - )rU�	enumerater	rb)�resolve_problemsr�count_problems�i�rss     r#�_format_resolve_problemsr'�s���
�C��*�+�a�/�N��+�1�5���2���5�1�Y�<�'�'�A�+�5�5�C��5�1�Y�<�'�$�.�.�C��x�}�}�R� � ��6��Jr%c��|j�dz}|j��)|j�dk7r||j�dzz
}||j�zdz|j�zdz|j	�zS)N�-�0�:�.)�N�E�V�R�A)�te�nevras  r#�	_te_nevrar4�sm���D�D�F�S�L�E�	�t�t�v��b�d�d�f��m�
�����#�����2�4�4�6�>�C��"�$�$�&�(�3�.�����7�7r%c
���tjd�|D]b}|j�}d}|�|j}dj	t|�|||j
��}tj|��d|D]l}dj	t|�|j|j|j|j|j��}tj|��ny)NzLogging transaction elementsz@RPM element: '{}', Key(): '{}', Key state: '{}', Failed() '{}': z^SWDB element: '{}', State: '{}', Action: '{}', From repo: '{}', Reason: '{}', Get reason: '{}')r7�debug�Key�stater�r4�Failedr6�action�	from_repo�reason�
get_reason)�rpm_transaction�swdb_transaction�rpm_el�tsi�	tsi_staters      r#�_log_rpm_trans_with_swdbrC�s���
�L�L�/�0�!���j�j�l���	��?��	�	�I�P�W�W��f��s�I�v�}�}��@�����S��"� ��!�!'���C��#�)�)�S�Z�Z����X[�Xb�Xb�(+���(8�":�	�	���S��	 r%c��tjjtjjtjjtjj
tjjh}|D�cgc]}|��}}d}d}|D�]}t|�}|j�}|�t|d�sP|D]K}	|	jtjjk7r�+|	j|vr�:t|	�|k(s�I|	}n|�t|d�s0tjt!d�j#|��d}��|j%�r"tjj&|_
d}��tjj(|_
��|D]b}|jtjjk(s�+tjt!d�j#t|���d}�d|rtj+t!d��|r
t-||�yycc}w)NF�pkgz%TransactionItem not found for key: {}Tz)TransactionSWDBItem not found for key: {}z#Errors occurred during transaction.)r/�transaction� TransactionItemAction_DOWNGRADED�TransactionItemAction_OBSOLETED�TransactionItemAction_REMOVE�TransactionItemAction_UPGRADED�!TransactionItemAction_REINSTALLEDr4r7�hasattrr8�TransactionItemState_UNKNOWNr:r6r7rr	r�r9�TransactionItemState_ERROR�TransactionItemState_DONEr6rC)
r>r?�revert_actionsrA�
cached_tsi�el_not_foundr8r@�te_nevra�
tsi_candidates
          r#�_sync_rpm_trans_with_swdbrU�s����(�(�I�I��(�(�H�H��(�(�E�E��(�(�G�G��(�(�J�J�	L�N�
"2�2�!1�#�#�!1�J�2��L��E�!���V�$���j�j�l���;�g�c�5�1�!+�
� �&�&�&�*<�*<�*Y�*Y�Y�� �'�'�~�=���}�%��1�'�C��",��;�g�c�5�1��O�O�A�E�F�M�M�h�W�X��L���=�=�?��*�*�E�E�C�I��E��*�*�D�D�C�I�)"�*���9�9��*�*�G�G�G��O�O�A�I�J�Q�Q�RU�VY�RZ�[�\��L��
����Q�<�=�>�� ��*�=���=3s�	H;c��eZdZd�Zd�Zd�Zy)�tmpdirc�t�dtjjz}tj|��|_y)Nz%s-)r
)r�const�PREFIXrF�mkdtempra)�selfr
s  r#�__init__ztmpdir.__init__�s(������)�)�)���$�$�F�3��	r%c��|jSrTr��r\s r#�	__enter__ztmpdir.__enter__�s���y�y�r%c�.�t|j�yrT)rcra)r\�exc_type�	exc_value�	tracebacks    r#�__exit__ztmpdir.__exit__�s��
�d�i�i�r%N)r�
__module__�__qualname__r]r`rer]r%r#rWrW�s��4��r%rWc�(��eZdZdZ�fd�Zd�Z�xZS)�Bunchz�Dictionary with attribute accessing syntax.

    In DNF, prefer using this over dnf.yum.misc.GenericHolder.

    Credit: Alex Martelli, Doug Hudgeon

    c�:��tt|�
|i|��||_yrT)�superrir]�__dict__)r\�args�kwds�	__class__s   �r#r]zBunch.__init__�s���	�u�d�	$�d�	3�d�	3���r%c��t|�SrT)�idr_s r#�__hash__zBunch.__hash__s���$�x�r%)rrfrg�__doc__r]rr�
__classcell__�ros@r#riri�s�����r%ric�*��eZdZ�fd�Zd�Zd�Z�xZS)�
MultiCallListc�L��tt|��|j|�yrT)rkrwr]�extend)r\ryros  �r#r]zMultiCallList.__init__s���
�m�T�+�-����H�r%c������fd�}|S)Nc�@�������fd�}tt|���S)Nc�,��t|��}|�i���SrT)r�)�v�methodrmrP�whats  ���r#�	call_whatz8MultiCallList.__getattr__.<locals>.fn.<locals>.call_what
s��� ��D�)���t�.�v�.�.r%r�)rmrPr�r\rs`` ��r#r�z%MultiCallList.__getattr__.<locals>.fns���
/���I�t�,�-�-r%r])r\rr�s`` r#�__getattr__zMultiCallList.__getattr__s���	.�
�	r%c�<�����fd�}tt||��S)Nc� ��t|���yrT)r)r�r�rs ��r#�setterz)MultiCallList.__setattr__.<locals>.setters����D�$��$r%r�)r\rr�r�s `` r#�__setattr__zMultiCallList.__setattr__s���	%��C���%�&�&r%)rrfrgr]r�r�rtrus@r#rwrws�����'r%rwc��tgggggggggggd��}|D�]�}|jtjjk(r|j
j
|��G|jtjjk(r|jj
|���|jtjjk(r�|jtjjk(r|jj
|���|jtjjk(r|jj
|���8|jtjj k(r|j"j
|���||j$j
|����|jtjj&k(r|j(j
|����|jtjj*k(r�|jtjj,k(r|j.j
|���H|jtjjk(r|j0j
|����|j2j
|����|jtjj4k(s���|j6j
|����|S)N)�
downgraded�erased�erased_clean�
erased_dep�	installed�installed_group�
installed_dep�installed_weak�reinstalled�upgraded�failed)rir8r/rFrNr�rr:�TransactionItemAction_DOWNGRADEr��TransactionItemAction_INSTALLr<�TransactionItemReason_GROUPr�� TransactionItemReason_DEPENDENCYr��%TransactionItemReason_WEAK_DEPENDENCYr�r��TransactionItemAction_REINSTALLr�rI�TransactionItemReason_CLEANr�r�r��TransactionItemAction_UPGRADEr�)rFrCrAs   r#�_make_listsr�s��
�������������	�A����9�9��*�*�E�E�E�
�H�H�O�O�C� �
�Z�Z�6�-�-�M�M�
M�
�L�L����$�
�Z�Z�6�-�-�K�K�
K��z�z�V�/�/�K�K�K��!�!�(�(��-����v�1�1�R�R�R����&�&�s�+����v�1�1�W�W�W�� � �'�'��,����"�"�3�'�
�Z�Z�6�-�-�M�M�
M�
�M�M� � ��%�
�Z�Z�6�-�-�J�J�
J��z�z�V�/�/�K�K�K����%�%�c�*����v�1�1�R�R�R����#�#�C�(�������$�
�Z�Z�6�-�-�K�K�
K�
�J�J���c�"�3�6
�Hr%c�����fd�}tjj|�}�jd|��\}}|j	|�}g}td�|jftd�|jftd�|j|jz|jz|jzftd�|jftd�|ftd	�|j|jz|jzftd
�|j ffD];\}	}
|j#||	t%|
t'j(|������=|S)alReturns a human-readable summary of the results of the
    transaction.

    :param action_callback: function generating output for specific action. It
       takes two parameters - action as a string and list of affected packages for
       this action
    :return: a list of lines containing a human-readable summary of the
       results of the transaction
    c�T��|j|jkD|j|jkz
}|dk7r|Stj|j|j|j|j
|j��}tj|j|j|j|j
|j��}|j|�j�}|dk7r|S|j|jkD|j|jkz
S)z�Compares two transaction items or packages by nevra.
           Used as a fallback when tsi does not contain package object.
        r)�name�epoch�version�release�arch)	r��hawkey�NEVRAr�r�r�r��evr_cmp�sack)�item1�item2�ret�nevra1�nevra2�bases     �r#�_tsi_or_pkg_nevra_cmpz7_post_transaction_output.<locals>._tsi_or_pkg_nevra_cmpPs�����z�z�E�J�J�&�5�:�:��
�
�+B�C���!�8��J����5�:�:�U�[�[�%�-�-�&+�m�m�%�*�*�F�����5�:�:�U�[�[�%�-�-�&+�m�m�%�*�*�F���n�n�V�T�Y�Y�/���!�8��J��
�
�U�Z�Z�'�E�J�J����,C�D�Dr%F)�report_problemsrF�Upgraded�
Downgraded�	Installed�Reinstalled�Skipped�Removedr9)�key)r�utilr��_skipped_packages�unionr	r�r�r�r�r�r�r�r�r�r�r�ry�sortedr��
cmp_to_key)r�rF�action_callbackr��
list_bunch�skipped_conflicts�skipped_broken�skippedrr:�tsiss`          r#�_post_transaction_outputr�Fsc���E� ���%�%�k�2�J�(,�(>�(>��;�)?�)8�%��~��%�%�n�5�G�
�C��j�M�:�+>�+>�?��l�O�Z�-B�-B�C��k�N�J�,@�,@�&�6�6�-7�&�5�5�-6�'�4�4�-5�6��m�,�j�.D�.D�E��i�L�'�2��i�L�*�*;�*;�)�4�4�+5�)�6�6�+7�8��h�K��):�):�;�=����	�
�
�?��F�4�Y�%9�%9�:O�%P�Q�S�	T�=��Jr%c� �|r|Std�S)Nz<name-unset>)r	)�
input_names r#�_name_unset_wrapperr�ys��#�:�:��>�):�:r%c�l�|D]/}tjj|�}|js�/yy)NTF)r�subject�Subject�_filename_pattern)�specs�spec�subjs   r#�_is_file_pattern_presentr�~s1�����{�{�"�"�4�(���!�!���r%c�l�eZdZdZdZd�Zed��Zed��Z	d�Z
d�Zed��Zed	��Z
d
�Zy)�_BootcSystemz/usric�0�|j�sttd���ddl}||_|jdd�ddlm}||_|jjj�|_|jj�|_
y)NzNot running on a bootc system.r�OSTreez1.0)r�)�is_bootc_systemr3r	�gi�_gi�require_version�
gi.repositoryr��_OSTree�Sysroot�new_default�_sysroot�require_booted_deployment�_booted_deployment)r\r�r�s   r#r]z_BootcSystem.__init__�st���#�#�%��q�!A�B�C�C�����
���8�U�+�(�������,�,�8�8�:��
�#'�-�-�"I�"I�"K��r%c�D�d}tjj|�S)zYReturns true is the system is managed as an immutable container, false
        otherwise.z/run/ostree-booted)r[ra�isfile)�
ostree_booteds r#r�z_BootcSystem.is_bootc_system�s��-�
��w�w�~�~�m�,�,r%c�^�tj|jtj�S)z-Returns true if and only if /usr is writable.)r[r�usr�W_OK)�clss r#�is_writablez_BootcSystem.is_writable�s���y�y����"�'�'�*�*r%c�6�|jj�SrT)r��get_unlockedr_s r#�_get_unlocked_statez _BootcSystem._get_unlocked_state�s���&�&�3�3�5�5r%c�d�|j�|jjjk(S)z�Returns true if and only if the bootc system is unlocked in a
        transient state, i.e. a overlayfs is mounted as read-only on /usr.
        Changes can be made to the overlayfs by remounting /usr as
        read/write in a private mount namespace.)r�r��DeploymentUnlockedState�	TRANSIENTr_s r#�is_unlocked_transientz"_BootcSystem.is_unlocked_transient�s(��
�'�'�)�T�\�\�-Q�-Q�-[�-[�[�[r%c��tjd�}|j|j�dk7rt	d��dddd|j
g}	t
j|d��}|j�y#t$r/tjjtd	�|dz��tj$r?tjjtd
|j
j���wxYw)Nrz!Failed to unshare mount namespace�mountz--options-source=disablez-oz
remount,rwT��textz%s: command not found.z$Failed to mount %s as read/write: %s)�ctypes�CDLL�unshare�CLONE_NEWNSrir��
subprocess�run�check_returncode�FileNotFoundErrorr�
exceptions�Errorr	�CalledProcessError�stderr)r��libc�
mount_command�completed_processs    r#�_set_up_mountnsz_BootcSystem._set_up_mountns�s����{�{�4� ���<�<����(�A�-��=�>�>� �"<�d�L�RU�RY�RY�Z�
�	u� *���}�4� H���.�.�0�� �	W��.�.�&�&�q�)A�'B�]�ST�EU�'U�V�V��,�,�	u��.�.�&�&�q�)O�QT�QX�QX�Zk�Zr�Zr�'s�t�t�	u�s
�'A9�9BDc�\�gd�}	tj|d��}|j�y#t$r/tj
j
td�|dz��tj$r4tj
j
tdj���wxYw)N)�ostree�admin�unlockz--transientTr�z.%s: command not found. Is this a bootc system?rzFailed to unlock system: %s)
r�r�r�r�rr�r�r	r�r�)�unlock_commandr�s  r#�_unlockz_BootcSystem._unlock�s���E��	c� *���~�D� I���.�.�0�� �	p��.�.�&�&�q�)Y�'Z�]k�lm�]n�'n�o�o��,�,�	c��.�.�&�&�q�)F�HY�H`�H`�'a�b�b�	c�s
�'.�A=B+c���|j�}|jjj|jjj|jjj
|jjjf}||vr!ttd�|jz��|jjj|jjjf}||vry||jjjk(r!|j�|j�y||jjj
k(r|j�yy)z+Set up a writable overlay on bootc systems.z"Unhandled bootc unlocked state: %sN)r�r�r��NONE�DEVELOPMENTr��HOTFIXr�r	�
value_nickrr�)r\�bootc_unlocked_state�valid_bootc_unlocked_states�writable_unlocked_statess    r#�
make_writablez_BootcSystem.make_writable�s,�� $�7�7�9��
�L�L�0�0�5�5��L�L�0�0�<�<��L�L�0�0�:�:��L�L�0�0�7�7�	'
�#� �'B�B��Q�C�D�G[�Gf�Gf�f�g�g�
�L�L�0�0�<�<��L�L�0�0�7�7�$
� � �#;�;�
�
!�T�\�\�%I�%I�%N�%N�
N�
�L�L�N�� � �"�
!�T�\�\�%I�%I�%S�%S�
S�
� � �"�Tr%N)rrfrgr�r�r]�staticmethodr��classmethodr�r�r�r�rrr]r%r#r�r��su��
�C��K�3�$�-��-��+��+�6�\��u��u�$�c��c� "r%r�rT)NNzw+b)F)V�
__future__rrrrrr�dnf.i18nr	r
�argparser�r�dnf.callback�	dnf.const�
dnf.pycomprjr�r�r�r��loggingr[r�r�r��sysrFr��libdnf.repor/�libdnf.transaction�	getLoggerr7�ArgumentParser�prog�	MAIN_PROG�upper�MAIN_PROG_UPPERr$rArRrXr^rfrnrur{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rcrrr�stdoutrr'r4rCrUrrW�dictrirxrwr�r�r�r�r�r]r%r#�<module>r!s���*&�&�'�#���
�
������
��
��	�
�
��
�����	��	�	�5�	!��.E�h�.E�.E�.G�.L�.L�PU�.U�#�H�#�#�%�*�*�[`�	��/�/�#���.�@
��(
�����(���,� �(��:���U�
+��"�
��(L�:>�
��0�
�#���
�
�
�$�$8��"%>�P
�V�
�
�D�
� '�D�'�&*
�Z0�f;�
�j"�j"r%

Youez - 2016 - github.com/yon3zu
LinuXploit