#!/bin/bash

fedora_releases="35 36 37 38"
fedora_developments="39 40"
fedora_rawhide="40"
archs="i686 x86_64 aarch64 armhfp"

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

        createrepo_c --update --pretty --deltas releases/$version/$arch/os/ 
        gpg2 --batch --yes --detach-sign --armor releases/$version/$arch/os/repodata/repomd.xml

        createrepo_c --update --pretty --deltas 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_c --update --pretty --deltas releases/$version/source/SRPMS/
    gpg2 --batch --yes --detach-sign --armor releases/$version/source/SRPMS/repodata/repomd.xml
done

# Developments
for version in $fedora_developments
do
    # Creates regular repos
    for arch in $archs
    do
        mkdir -p development/$version/$arch/os
        mkdir -p development/$version/$arch/debug

        createrepo_c --update --pretty --deltas development/$version/$arch/os/
        gpg2 --batch --yes --detach-sign --armor development/$version/$arch/os/repodata/repomd.xml

        createrepo_c --update --pretty --deltas development/$version/$arch/debug/
        gpg2 --batch --yes --detach-sign --armor development/$version/$arch/debug/repodata/repomd.xml
    done

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

    createrepo_c --update --pretty --deltas development/$version/source/SRPMS/
    gpg2 --batch --yes --detach-sign --armor development/$version/source/SRPMS/repodata/repomd.xml
done

