#!/bin/sh

CLOUD_PTF="/srv/tftpboot/repos/Cloud-PTF"

if test ! -d "${CLOUD_PTF}"; then
  echo "Directory ${CLOUD_PTF} does not exist."
  exit 1
fi

createrepo "${CLOUD_PTF}"

if test -n "$(gpg --list-secret-keys 2> /dev/null)"; then
  gpg -a --detach-sign --yes "${CLOUD_PTF}/repodata/repomd.xml"
fi
