#!/usr/bin/env bash

set -euo pipefail

repos_base_dir="/storage/mirror/centos/8/"

# Start sync if base repo directory exist
if [[ -d "$repos_base_dir" ]] ; then
  # Start Sync
  /usr/bin/rsync  -avSHP --delete archive.kernel.org::centos-vault/centos/8/  "$repos_base_dir"
  # Download CentOS 8 repository key
  wget -P $repos_base_dir wget https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official
fi
