#!/bin/bash

# update_repos() - Function that updates linux repositories
function update_repos {
    echo "Updating repositories list..."
    if [ -f /var/onap/files/sources.list ]; then
        cp /var/onap/files/sources.list /etc/apt/sources.list
    fi
    if [[ "$debug" == "False" ]]; then
        apt-get update > /dev/null
    else
        apt-get update
    fi
}

# is_package_installed() - Function to tell if a package is installed
function is_package_installed {
    if [[ -z "$@" ]]; then
        return 1
    fi
    dpkg -s "$@" > /dev/null 2> /dev/null
}

# install_packages() - Install a list of packages
function install_packages {
    local package=$@
    update_repos
    apt-get install -y -qq $package
}

# install_package() - Install specific package if doesn't exist
function install_package {
    local package=$1

    if ! is_package_installed $package; then
        echo "Installing $package..."

        if [[ "$debug" == "False" ]]; then
            apt-get install -y -qq -o=Dpkg::Use-Pty=0 $package
        else
            apt-get install -y $package
        fi
    fi
}

# uninstall_packages() - Uninstall a list of packages
function uninstall_packages {
    local packages=$@
    apt-get purge -y -qq $packages
}

# uninstall_package() - Uninstall specific package if exists
function uninstall_package {
    local package=$1
    if is_package_installed $package; then
        apt-get purge -y -qq $package
    fi
}
