#!/bin/bash
#
# Univention Updater
#  univention-remove
#
# SPDX-FileCopyrightText: 2012-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##*/} uninstalls specified packages from the local system."
	echo "The command of UCR variable update/commands/remove/interactive is"
	echo "used for uninstallation after package list has been updated."
	exit 1
fi

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