#!/bin/bash

set -e          # exit on error
set -o pipefail # exit on pipeline error
set -u          # treat unset variable as error

. /minioslib
. /minios_build.conf

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

/condinapt -l "$SCRIPT_DIR/$PACKAGE_VARIANT.list" -c "${SCRIPT_DIR}/minios_build.conf" -m "${SCRIPT_DIR}/condinapt.map"
if [ $? -ne 0 ]; then
    echo "Failed to install packages."
    exit 1
fi
if [ $LOCALE != "en_US" ]; then
    /condinapt -l "$SCRIPT_DIR/$PACKAGE_VARIANT-l10n.list" -c "${SCRIPT_DIR}/minios_build.conf" -m "${SCRIPT_DIR}/condinapt.map"
    if [ $? -ne 0 ]; then
        echo "Failed to install packages."
        exit 1
    fi
fi

rm -f /usr/share/applications/xterm.desktop
