File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/opkg.cpython-310.pyc
o
�N�gQ� � @ sh d Z ddlZddlZddlZddlZddlZddlZddlZddlZ ddl
Z ddlZ ddlZ ddl
Z ddlZ ddlZ ddlZ ddlmZmZmZ ddlmZ dZdZddd d
ddd
�Ze�e�ZdZdZdd� Zdd� Zdd� Z dd� Z!dd� Z"dd� Z#dd� Z$e$Z%dd� Z&drd!d"�Z'd#d$� Z(d%d&� Z)d'd(� Z*d)d*� Z+d+d,� Z, dsd-d.�Z-d/d0� Z.dtd1d2�Z/dtd3d4�Z0dud6d7�Z1dvd8d9�Z2dvd:d;�Z3d<d=� Z4d>d?� Z5d@dA� Z6drdBdC�Z7dudDdE�Z8dFdG� Z9dHdI� Z:dJdK� Z;dLdM� Z< drdNdO�Z=dPdQ� Z>dRdS� Z?dTdU� Z@dVdW� ZAdXdY� ZBdZd[� ZCd\d]� ZDd^d_� ZEd`da� ZFdbdc� ZGddde� ZHdfdg� ZIdhdi� ZJdjdk� ZKdldm� ZLdndo� ZMdpdq� ZNdS )wa�
Support for Opkg
.. important::
If you feel that Salt should be using this module to manage packages on a
minion, and it is using a different module (or gives an error similar to
*'pkg.install' is not available*), see :ref:`here
<module-provider-override>`.
.. versionadded:: 2016.3.0
.. note::
For version comparison support on opkg < 0.3.4, the ``opkg-utils`` package
must be installed.
� N)�CommandExecutionError�MinionError�SaltInvocationError)�Versionz3^#?\s*(src|src/gz)\s+([^\s<>]+|"[^<>]+")\s+[^\s<>]+z /etc/opkg�arch�urlZinstall_date_time_tZpackager�name�group)ZArchitectureZHomepagezInstalled-TimeZ
MaintainerZPackageZSection�pkgz /var/lib/salt/restartcheck_statec C s d� dt�d�v rd�S d�S )Nz$/usr/lib/{}/nisysapi/conf.d/experts/ZarmZcpuarchzarm-linux-gnueabizx86_64-linux-gnu)�format�
__grains__�get� r r �E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/opkg.py�_get_nisysapi_conf_d_path9 s ���r c C s� t d d�} t d d�| t�� t d d�| t�� d}tj�|�r6t d d�|t�� t d d�|t�� t� }tj�|�r{tjj �
t� d �d
��}|�tt
t�|���� W d � n1 saw Y t�|�D ]}tt�||�t�t�d� qkdS dS )
a�
NILRT systems determine whether to reboot after various package operations
including but not limited to kernel module installs/removals by checking
specific file md5sums & timestamps. These files are touched/modified by
the post-install/post-remove functions of their respective packages.
The opkg module uses this function to store/update those file timestamps
and checksums to be used later by the restartcheck module.
�cmd.run_stdoutzuname -r� cmd.shellz@stat -c %Y /lib/modules/{}/modules.dep >{}/modules.dep.timestampz9md5sum /lib/modules/{}/modules.dep >{}/modules.dep.md5sumz%/usr/local/natinst/share/nisysapi.iniz(stat -c %Y {} >{}/nisysapi.ini.timestampz!md5sum {} >{}/nisysapi.ini.md5sumz/sysapi.conf.d.count�wN��filenameZfingerprint_dir)�__salt__r �NILRT_RESTARTCHECK_STATE_PATH�os�path�existsr �salt�utils�files�fopen�write�str�len�listdir�_fingerprint_file�pathlib�Path)�unameZ
nisysapi_pathZnisysapi_conf_d_pathZfcountZfexpertr r r �_update_nilrt_restart_stateA sL ��������
��
��r'