#!/bin/bash

fedoras="29 30 31"
archs="i686 x86_64 aarch64 armhfp"

for version in $fedoras
do
    # Creates regular repos
    for arch in $archs
    do
        mkdir -p releases/$version/$arch/os
        mkdir -p releases/$version/$arch/debug

        createrepo --pretty --deltas --basedir=releases/$version/$arch/os/ --output=releases/$version/$arch/os/ .
        gpg2 --batch --yes --detach-sign --armor releases/$version/$arch/os/repodata/repomd.xml

        createrepo --pretty --deltas --basedir=releases/$version/$arch/debug/ --output=releases/$version/$arch/debug/ .
        gpg2 --batch --yes --detach-sign --armor releases/$version/$arch/debug/repodata/repomd.xml
    done

    # Creates SRPMS repo
    mkdir -p releases/$version/source/SRPMS

    createrepo --pretty --deltas --basedir=releases/$version/source/SRPMS/ --output=releases/$version/source/SRPMS/ .
    gpg2 --batch --yes --detach-sign --armor releases/$version/source/SRPMS/repodata/repomd.xml
done
