File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/freebsdports.cpython-310.pyc
Back
o ;j4 � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl m Z mZ e�e �ZdZdd� Zdd� Zd d � Zdd� Zd d� Zdd� Zdd� Zd%dd�Zdd� Zdd� Zd&dd�Zd'dd�Zd'dd �Zd!d"� Zd#d$� ZdS )(a� Install software from the FreeBSD ``ports(7)`` system .. versionadded:: 2014.1.0 This module allows you to install ports using ``BATCH=yes`` to bypass configuration prompts. It is recommended to use the :mod:`ports state <salt.states.freebsdports>` to install ports, but it is also possible to use this module exclusively from the command line. .. code-block:: bash salt minion-id ports.config security/nmap IPV6=off salt minion-id ports.install security/nmap � N)�CommandExecutionError�SaltInvocationErrorZportsc C s t d dkrtS dS )z& Only runs on FreeBSD systems �osZFreeBSD)FzVThe freebsdports execution module cannot be loaded: only available on FreeBSD systems.)� __grains__�__virtualname__� r r �M/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/freebsdports.py�__virtual__! s r c C s$ dg} t td �dkr| �d� | S )zN Return 'portsnap --interactive' for FreeBSD 10, otherwise 'portsnap' ZportsnapZ osrelease� z --interactive)�floatr �append)�retr r r � _portsnap. s r c C sP t | t�r d| vrtd| � d���tj�d| �}tj�|�s&td|� d���|S )zc Check if portname is valid and whether or not the directory exists in the ports tree. �/zInvalid port name 'z' (category required)� /usr/portszPath 'z' does not exist)� isinstance�strr r �path�join�isdir)�namer r r r �_check_portname8 s r c C sN t | � d}tj�|| �dd��}tj�|| �d�d �}tj�|�r%|S |S )zO Retrieve the path to the dir containing OPTIONS file for a given port z /var/db/portsr �_���)r r r r �replace�splitr )r �_root�new_dir�old_dirr r r �_options_dirG s r c C s t j�t j�t| �d��S )zh Returns True/False based on whether or not the options file for the specified port exists. �options)r r �isfiler r )r r r r �_options_file_existsX s r"