#!/bin/sh

set -e

if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remove" ]; then

  if [ -x /usr/bin/apt-key ]; then
    for KEY in pointlinux; do
      /usr/bin/apt-key add /usr/share/keyrings/$KEY.gpg
    done
  fi

  # Install new config files
  export UCF_FORCE_CONFFNEW=yes
  for FILE in /etc/apt/sources.list.d/pointlinux.list; do
    if [ -e $FILE.new ]; then
      ucf $FILE.new $FILE
      ucf --purge $FILE.new
      rm $FILE.new
    fi
  done
fi