#!/bin/bash
set -e
DEBIAN_FRONTEND="noninteractive"
DEBIAN_PRIORITY="critical"
DEBCONF_NOWARNINGS="yes"
export DEBIAN_FRONTEND DEBIAN_PRIORITY DEBCONF_NOWARNINGS
apt update || echo failed to update index lists
dpkg --configure -a || echo failed to fix interrupted upgrades
apt --fix-broken --fix-missing install || echo failed to fix conflicts
apt -y --fix-broken --fix-missing full-upgrade
apt -y full-upgrade
if [ -x /usr/bin/flatpak ]; then
	echo upgrading flatpaks
	flatpak update --assumeyes --noninteractive
	echo uninstalling unused flatpaks
	flatpak uninstall --unused --assumeyes --noninteractive
fi
