File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/macpackage.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZddlZe�e�ZdZ dd� Z ddd �Zddd�Zd d� Z dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� ZdS )z; Install pkg, dmg and .app applications on macOS minions. � NZ macpackagec C s t jj�� rtS dS )z Only work on Mac OS )Fz+Only available on Mac OS systems with pipes)�salt�utils�platformZ is_darwin�__virtualname__� r r �K/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/macpackage.py�__virtual__ s r �LocalSystemFc C sd d| vr t �| �} t �|�}d| � d|� �}|r|d7 }|r"|d7 }d}d|v r*d}td ||d �S ) a� Install a pkg file Args: pkg (str): The package to install target (str): The target in which to install the package to store (bool): Should the package be installed as if it was from the store? allow_untrusted (bool): Allow the installation of untrusted packages? Returns: dict: A dictionary containing the results of the installation CLI Example: .. code-block:: bash salt '*' macpackage.install test.pkg �*.zinstaller -pkg z -target z -storez -allowUntrustedFTzcmd.run_all��python_shell)�shlex�quote�__salt__)�pkg�target�storeZallow_untrusted�cmdr r r r �install s r �/Applications/c C s� |dd� dkr(| dd� dkrt j�| dd� �}nt j�| �}t j�||�}| d dks2| d7 } d| � d|� d�}td |�S ) a� Install an app file by moving it into the specified Applications directory Args: app (str): The location of the .app file target (str): The target in which to install the package to Default is ''/Applications/'' Returns: str: The results of the rsync command CLI Example: .. code-block:: bash salt '*' macpackage.install_app /tmp/tmp.app /Applications/ ���Nz.app����/zrsync -a --delete "z" "�"�cmd.run)�os�path�basename�joinr )�appr Zbase_appr r r r �install_appC s r c C s t d | �S )a7 Uninstall an app file by removing it from the Applications directory Args: app (str): The location of the .app file Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' macpackage.uninstall_app /Applications/app.app �file.remove�r )r r r r � uninstall_appe s r# c C s0 t d dd�}d|� d| � d�}t d |�|fS )a� Attempt to mount a dmg file to a temporary location and return the location of the pkg file inside Args: dmg (str): The location of the dmg file to mount Returns: tuple: Tuple containing the results of the command along with the mount point CLI Example: .. code-block:: bash salt '*' macpackage.mount /tmp/software.dmg �temp.dirzdmg-��prefixz/hdiutil attach -readonly -nobrowse -mountpoint z "r r r"