salt.modules.mac_package module

Install pkg, dmg and .app applications on macOS minions.

salt.modules.mac_package.get_mpkg_ids(mpkg)

Attempt to get the package IDs from a mounted .mpkg file

Parameters:mpkg (str) -- The location of the mounted mpkg file
Returns:List of package IDs
Return type:list

CLI Example:

salt '*' macpackage.get_mpkg_ids /dev/disk2
salt.modules.mac_package.get_pkg_id(pkg)

Attempt to get the package ID from a .pkg file

Parameters:pkg (str) -- The location of the pkg file
Returns:List of all of the package IDs
Return type:list

CLI Example:

salt '*' macpackage.get_pkg_id /tmp/test.pkg
salt.modules.mac_package.install(pkg, target=u'LocalSystem', store=False, allow_untrusted=False)

Install a pkg file

Parameters:
  • 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:

A dictionary containing the results of the installation

Return type:

dict

CLI Example:

salt '*' macpackage.install test.pkg
salt.modules.mac_package.install_app(app, target=u'/Applications/')

Install an app file by moving it into the specified Applications directory

Parameters:
  • app (str) -- The location of the .app file
  • target (str) -- The target in which to install the package to Default is ''/Applications/''
Returns:

The results of the rsync command

Return type:

str

CLI Example:

salt '*' macpackage.install_app /tmp/tmp.app /Applications/
salt.modules.mac_package.installed_pkgs()

Return the list of installed packages on the machine

Returns:List of installed packages
Return type:list

CLI Example:

salt '*' macpackage.installed_pkgs
salt.modules.mac_package.mount(dmg)

Attempt to mount a dmg file to a temporary location and return the location of the pkg file inside

Parameters:dmg (str) -- The location of the dmg file to mount
Returns:
Tuple containing the results of the command along with the mount
point
Return type:tuple

CLI Example:

salt '*' macpackage.mount /tmp/software.dmg
salt.modules.mac_package.uninstall_app(app)

Uninstall an app file by removing it from the Applications directory

Parameters:app (str) -- The location of the .app file
Returns:True if successful, otherwise False
Return type:bool

CLI Example:

salt '*' macpackage.uninstall_app /Applications/app.app
salt.modules.mac_package.unmount(mountpoint)

Attempt to unmount a dmg file from a temporary location

Parameters:mountpoint (str) -- The location of the mount point
Returns:The results of the hdutil detach command
Return type:str

CLI Example:

salt '*' macpackage.unmount /dev/disk2