def install(name, clean=True):
    portpath = _check_portname(name)
    old = __salt__['pkg.list_pkgs']()
    if old.get(name.rsplit('/')[-1]):
        deinstall(name)
    cmd = ['make', 'install']
    if clean:
        cmd.append('clean')
    cmd.append('BATCH=yes')
    result = __salt__['cmd.run_all'](
        cmd,
        cwd=portpath,
        reset_system_locale=False,
        python_shell=False
    )
    if result['retcode'] != 0:
        __context__['ports.install_error'] = result['stderr']
    __context__.pop('pkg.list_pkgs', None)
    new = __salt__['pkg.list_pkgs']()
    ret = salt.utils.compare_dicts(old, new)
    if not ret and result['retcode'] == 0:
        # No change in package list, but the make install was successful.
        # Assume that the installation was a recompile with new options, and
        # set return dict so that changes are detected by the ports.installed
        # state.
        ret = {name: {'old': old.get(name, ''),
                      'new': new.get(name, '')}}
    return ret
Install a port from the ports tree. Installs using ``BATCH=yes`` for
dataset/ETHPy150Open saltstack/salt/salt/modules/freebsdports.py/install