#!/usr/bin/env bash

case ${OS} in
devuan)
	case ${DIST} in
    ceres | beowulf | chimaera | daedalus)
      # https://www.devuan.org/os/keyring
      # Ceres, Beowulf, Chimaera and Daedalus
      RELEASE_KEY="94532124541922FB"
      gpg --keyserver keyring.devuan.org --recv-keys "${RELEASE_KEY}"
      gpg --fingerprint ${RELEASE_KEY}
      gpg --export ${RELEASE_KEY} >/tmp/devuan_key.gpg
      mkdir -p ${TARGET}/etc/apt/trusted.gpg.d/
      cp /tmp/devuan_key.gpg ${TARGET}/etc/apt/trusted.gpg.d/devuan_key.gpg
      ;;
    excalibur)
      # Excalibur
      RELEASE_KEY="B3982868D104092C"
      gpg --keyserver keyring.devuan.org --recv-keys "${RELEASE_KEY}"
      gpg --fingerprint "${RELEASE_KEY}"
      gpg --export ${RELEASE_KEY} >/tmp/devuan_key.gpg
      mkdir -p ${TARGET}/etc/apt/trusted.gpg.d/
      cp /tmp/devuan_key.gpg ${TARGET}/etc/apt/trusted.gpg.d/devuan_key.gpg
      ;;
    freia)
      RELEASE_KEY="55C470D57732684B"
      gpg --keyserver keyring.devuan.org --recv-keys "${RELEASE_KEY}"
      gpg --fingerprint "${RELEASE_KEY}"
      gpg --export ${RELEASE_KEY} >/tmp/devuan_key.gpg
      mkdir -p ${TARGET}/etc/apt/trusted.gpg.d/
      cp /tmp/devuan_key.gpg ${TARGET}/etc/apt/trusted.gpg.d/devuan_key.gpg
      ;;
	esac
  *)
  ;;
esac
