#!/bin/bash
function warning {
  echo -e "\e[33m$1\\e[39m"
}

function check-armhf() {
  ARMHF="$(dpkg --print-foreign-architectures | grep "armhf")"
}

purge_packages || exit 1

sudo rm -f /etc/apt/sources.list.d/box86.list || error "Failed to remove repo!"

sudo rm -f /usr/share/keyrings/box86-debs-archive-keyring.gpg /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg || error "Failed to remove GPG key!"

if [ "$arch" == 64 ]; then
  # remove armhf architecture if no packages from it are currently installed
  apt list --installed | awk '$3 == "armhf" { print }' | grep -q installed || sudo dpkg --remove-architecture armhf
fi
