hypercore-one / deployment

GNU General Public License v3.0
1 stars 1 forks source link

Enable noninteractive installation #11

Closed 0x3639 closed 1 week ago

0x3639 commented 2 weeks ago

Suggested code change

install_dependencies() {
    echo "Updating system and installing dependencies..."

    # Set environment variable to prevent prompts
    export DEBIAN_FRONTEND=noninteractive

    # Automatically select default options using -y and avoid interactive prompts
    apt-get update -y && apt-get upgrade -y

    # Check if make is installed
    if ! command -v make &> /dev/null; then
        echo "make could not be found"
        echo "Installing make..."
        apt-get install -y make
    fi

    # Check if gcc is installed
    if ! command -v gcc &> /dev/null; then
        echo "gcc could not be found"
        echo "Installing gcc..."
        apt-get install -y gcc
    fi

    # Check if jq is installed
    if ! command -v jq &> /dev/null; then
        echo "jq could not be found"
        echo "Installing jq..."
        apt-get install -y jq
    fi

    # Unset the environment variable after use
    unset DEBIAN_FRONTEND
}