Beispiel #1
0
def install(pkgs):
    '''
    Install the passed package(s) with ``brew install``

    pkgs
        The names of the packages to be installed

    Return a dict containing the new package names and versions::

        {'<package>': {'old': '<old-version>',
                   'new': '<new-version>']}

    CLI Example::

        salt '*' pkg.install 'package package package'
    '''
    if ',' in pkgs:
        pkgs = pkgs.split(',')
    else:
        pkgs = pkgs.split(' ')

    old = list_pkgs(*pkgs)

    formulas = ' '.join(pkgs)
    user = __salt__['file.get_user']('/usr/local')
    cmd = '/usr/local/bin/brew install {0}'.format(formulas)
    __salt__['cmd.run'](cmd, runas=user)

    new = list_pkgs(*pkgs)

    return _compare_versions(old, new)
Beispiel #2
0
def install(pkgs, refresh=False, repo='', skip_verify=False, **kwargs):
    '''
    Install the passed package(s) with ``brew install``

    pkgs
        The names of the packages to be installed

    Return a dict containing the new package names and versions::

        {'<package>': {'old': '<old-version>',
                   'new': '<new-version>']}

    CLI Example::

        salt '*' pkg.install 'package package package'
    '''
    if ',' in pkgs:
        pkgs = pkgs.split(',')
    else:
        pkgs = pkgs.split(' ')

    old = list_pkgs(*pkgs)

    formulas = ' '.join(pkgs)
    homebrew_prefix = __salt__['cmd.run']('brew --prefix')
    user = __salt__['file.get_user'](homebrew_prefix)
    cmd = 'brew install {0}'.format(formulas)
    if user != __opts__['user']:
        __salt__['cmd.run'](cmd, runas=user)
    else:
        __salt__['cmd.run'](cmd)

    new = list_pkgs(*pkgs)

    return _compare_versions(old, new)
Beispiel #3
0
def install(pkgs, refresh=False, repo='', skip_verify=False, **kwargs):
    '''
    Install the passed package(s) with ``brew install``

    pkgs
        The names of the packages to be installed

    Return a dict containing the new package names and versions::

        {'<package>': {'old': '<old-version>',
                   'new': '<new-version>']}

    CLI Example::

        salt '*' pkg.install 'package package package'
    '''
    if ',' in pkgs:
        pkgs = pkgs.split(',')
    else:
        pkgs = pkgs.split(' ')

    old = list_pkgs(*pkgs)

    formulas = ' '.join(pkgs)
    homebrew_prefix = __salt__['cmd.run']('brew --prefix')
    user = __salt__['file.get_user'](homebrew_prefix)
    cmd = 'brew install {0}'.format(formulas)
    if user != __opts__['user']:
        __salt__['cmd.run'](cmd, runas=user)
    else:
        __salt__['cmd.run'](cmd)

    new = list_pkgs(*pkgs)

    return _compare_versions(old, new)