#!/bin/bash
#
# Univention Updater
#  univention-install
#
# SPDX-FileCopyrightText: 2010-2025 Univention GmbH
# SPDX-License-Identifier: AGPL-3.0-only
#

LOGFILE="/var/log/univention/actualise.log"

if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
	echo "${0##*/} <package> [<package> ...]"
	echo
	echo "${0##*/} installs specified packages from (online) repository."
	echo "The command of UCR variable update/commands/install is used for"
	echo "installation after package list has been updated."
	exit 1
fi

export DEBIAN_FRONTEND=noninteractive
eval "$(ucr shell)"
echo "***** Starting \"univention-install $*\" on $(date)" >> "$LOGFILE"
set -e
set -o pipefail
${update_commands_update:-false} 2>&1 | tee -a "$LOGFILE"
# shellcheck disable=SC2086
exec ${update_commands_install_interactive:-false} "$@" 2>&1 | tee -a "$LOGFILE"
