#!/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=$@
    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
}
