(apt_list,
                      dnf_list,
                      yum_list,
                      interactive=True,
                      update=False)
Install binary packages

    Args:
        apt_list    : List of package names for installation via apt
        dnf_list    : List of package names for installation via dnf
        dnf_list    : List of package names for installation via yum
        interactive : Whether to run an interactive install (w/ user prompting)
        update      : Whether to update pre-installed packages instead
Install binary packages
Install binary packages
def _install_packages(apt_list,
                      dnf_list,
                      yum_list,
                      interactive=True,
                      update=False):
    """Install binary packages

    Args:
        apt_list    : List of package names for installation via apt
        dnf_list    : List of package names for installation via dnf
        dnf_list    : List of package names for installation via yum
        interactive : Whether to run an interactive install (w/ user prompting)
        update      : Whether to update pre-installed packages instead


    """
    if (which("apt")):
        manager = "apt"
        cmd = ["apt-get", "install"]
        if (update):
            cmd.append("--only-upgrade")
        cmd.extend(apt_list)
    elif (which("dnf")):
        manager = "dnf"
        if (update):
            cmd = ["dnf", "upgrade"]
        else:
            cmd = ["dnf", "install"]
        cmd.extend(dnf_list)
    elif (which("yum")):
        manager = "yum"
        if (update):
            cmd = ["yum", "upgrade"]
        else:
            cmd = ["yum", "install"]
        cmd.extend(yum_list)
    else:
        raise RuntimeError("Could not find a supported package manager")

    env = None
    if (not interactive):
        cmd.append("-y")
        if (manager == "apt"):
            env = os.environ.copy()
            env["DEBIAN_FRONTEND"] = "noninteractive"

    runner.run(cmd, root=True, env=env)
def _install_packages ( apt_list , dnf_list , yum_list , interactive = True , update = False ) : if ( which ( "apt" ) ) : manager = "apt" cmd = [ "apt-get" , "install" ] if ( update ) : cmd . append ( "--only-upgrade" ) cmd . extend ( apt_list ) elif ( which ( "dnf" ) ) : manager = "dnf" if ( update ) : cmd = [ "dnf" , "upgrade" ] else : cmd = [ "dnf" , "install" ] cmd . extend ( dnf_list ) elif ( which ( "yum" ) ) : manager = "yum" if ( update ) : cmd = [ "yum" , "upgrade" ] else : cmd = [ "yum" , "install" ] cmd . extend ( yum_list ) else : raise RuntimeError ( "Could not find a supported package manager" ) env = None if ( not interactive ) : cmd . append ( "-y" ) if ( manager == "apt" ) : env = os . environ . copy ( ) env [ "DEBIAN_FRONTEND" ] = "noninteractive" runner . run ( cmd , root = True , env = env )