#!/bin/bash

set -ex

. parse-args "$@"

export DEBIAN_FRONTEND=noninteractive
apt update --yes --no-install-recommends

# if --full was passed, run full-upgrade
if [ "${FULL}" = "1" ]; then
    apt full-upgrade --yes --no-install-recommends
fi

# if ARGS is not empty, install the packages
if [ ${#ARGS[@]} -gt 0 ]; then
    apt install --yes --no-install-recommends "${ARGS[@]}"
fi

apt autoremove --yes
apt clean --yes
rm -rf /var/lib/apt/lists/*