#!/bin/bash

almapath=http://172.16.2.1/repository/RPM

###########

almarepo=`cat <<_EOF_

[baseos]
name=AlmaLinux 8.10 - BaseOS
baseurl=$almapath/Almalinux8/baseos/
enabled=1
gpgcheck=0

[devel]
name=AlmaLinux 8.10 - Devel
baseurl=$almapath/Almalinux8/devel/
enabled=1
gpgcheck=0

[appstream]
name=AlmaLinux 8.10 - AppStream
baseurl=$almapath/Almalinux8/appstream/
enabled=1
gpgcheck=0

[extras]
name=AlmaLinux 8.10 - Extras
baseurl=$almapath/Almalinux8/extras/
enabled=1
gpgcheck=0

[ha]
name=AlmaLinux 8.10 - HighAvailability
baseurl=$almapath/Almalinux8/ha/
enabled=1
gpgcheck=0

[nfv]
name=AlmaLinux 8.10 - Real Time for NFV
baseurl=$almapath/Almalinux8/nfv/
enabled=1
gpgcheck=0

[powertools]
name=AlmaLinux 8.10 - PowerTools
baseurl=$almapath/Almalinux8/powertools/
enabled=1
gpgcheck=0

[resilientstorage]
name=AlmaLinux 8.10 - ResilientStorage
baseurl=$almapath/Almalinux8/resilientstorage/
enabled=1
gpgcheck=0

[rt]
name=AlmaLinux 8.10 - Real Time
baseurl=$almapath/Almalinux8/rt/
enabled=1
gpgcheck=0

[sap]
name=AlmaLinux 8.10 - SAP
baseurl=$almapath/Almalinux8/sap/
enabled=1
gpgcheck=0

[saphana]
name=AlmaLinux 8.10 - SAP HANA
baseurl=$almapath/Almalinux8/saphana
enabled=1
gpgcheck=0

_EOF_`

###########

almareposrc=`cat <<_EOF_

## Sources ##

[baseos-source]
name=AlmaLinux 8.10 - BaseOS Source
baseurl=$almapath/Almalinux8/baseos-source/
enabled=1
gpgcheck=0

[devel-source]
name=AlmaLinux 8.10 - Devel Source
baseurl=$almapath/Almalinux8/devel-source/
enabled=1
gpgcheck=0

[appstream-source]
name=AlmaLinux 8.10 - AppStream Source
baseurl=$almapath/Almalinux8/appstream-source/
enabled=1
gpgcheck=0

[extras-source]
name=AlmaLinux 8.10 - Extras Source
baseurl=$almapath/Almalinux8/extras-source/
enabled=1
gpgcheck=0

[ha-source]
name=AlmaLinux 8.10 - HighAvailability Source
baseurl=$almapath/Almalinux8/ha-source/
enabled=1
gpgcheck=0

[nfv-source]
name=AlmaLinux 8.10 - Real Time for NFV Sources
baseurl=$almapath/Almalinux8/nfv-source/
enabled=1
gpgcheck=0

[powertools-source]
name=AlmaLinux 8.10 - PowerTools Source
baseurl=$almapath/Almalinux8/powertools-source/
enabled=1
gpgcheck=0

[resilientstorage-source]
name=AlmaLinux 8.10 - ResilientStorage Source
baseurl=$almapath/Almalinux8/resilientstorage-source/
enabled=1
gpgcheck=0

[rt-source]
name=AlmaLinux 8.10 - Real Time Sources
baseurl=$almapath/Almalinux8/rt-source/
enabled=1
gpgcheck=0

[sap-source]
name=AlmaLinux 8.10 - SAP Sources
baseurl=$almapath/Almalinux8/sap-source/
enabled=1
gpgcheck=0

[saphana-source]
name=AlmaLinux 8.10 - SAP HANA Sources
baseurl=$almapath/Almalinux8/saphana-source/
enabled=1
gpgcheck=0

_EOF_`

###########

el8repo=`cat <<_EOF_

[45drives_stable]
name = 45Drives EL8 Stable
baseurl = $almapath/el8/45drives_stable
enabled = 1
gpgcheck = 0

[bareos]
name=Backup Archiving Recovery Open Sourced (EL_8)
baseurl=$almapath/el8/bareos/bareos/
enabled=1
gpgcheck=0

[cloudstack-4.19]
name=cloudstack-4.19 for rhel
baseurl=$almapath/el8/cloudstack-4.19/
enabled=1
gpgcheck=0

[CollaboraOnline_CODE-rpm]
name=collaboraoffice
baseurl=$almapath/el8/collaboraoffice.com_repos_CollaboraOnline_CODE-rpm/
enabled=1
gpgcheck=0

[docker-ce-stable]
name=Docker CE Stable
baseurl=$almapath/el8/docker/docker-ce-stable/
enabled=1
gpgcheck=0

[epel]
name=Extra Packages for Enterprise Linux 8
baseurl=$almapath/el8/epel/epel/
enabled=1
gpgcheck=0

[vscodium_repo]
name=vscodium.com
baseurl=$almapath/el8/gitlab.com_paulcarroty_vscodium_repo/
enabled=1
gpgcheck=0

[home_uroni]
name=UrBackup (CentOS_8)
baseurl=$almapath/el8/home_uroni/
enabled=1
gpgcheck=0

[nginx-stable]
name=nginx stable repo
baseurl=$almapath/el8/nginx-stable/
gpgcheck=0
enabled=1
module_hotfixes=true

[opennebula]
name=opennebula
baseurl=$almapath/el8/opennebula/
enabled=1
gpgcheck=0

[passbolt-server]
name=Passbolt Server
baseurl=$almapath/el8/passbolt-server/
enabled=1
gpgcheck=0

[rpmfusion-free-tainted]
name=RPM Fusion for EL 8 - Free tainted
baseurl=$almapath/el8/rpmfusion/rpmfusion-free-tainted/
enabled=1
type=rpm-md
gpgcheck=0

[rpmfusion-free-updates]
name=RPM Fusion for EL 8 - Free - Updates
baseurl=$almapath/el8/rpmfusion/rpmfusion-free-updates/
enabled=1
gpgcheck=0

[rpmfusion-nonfree-tainted]
name=RPM Fusion for EL 8 - Nonfree tainted
baseurl=$almapath/el8/rpmfusion/rpmfusion-free-updates/
enabled=1
type=rpm-md
gpgcheck=0

[rpmfusion-nonfree-updates]
name=RPM Fusion for EL 8 - Nonfree - Updates
baseurl=$almapath/el8/rpmfusion/rpmfusion-nonfree-updates/
enabled=1
gpgcheck=0

[virtualbox]
name=Oracle Linux / RHEL / CentOS-8.10 - VirtualBox
baseurl=$almapath/el8/virtualbox/
enabled=1
gpgcheck=0

[zabbix]
name=Zabbix Official Repository
baseurl=$almapath/el8/zabbix/zabbix/
enabled=1
gpgcheck=0

[zabbix-non-supported]
name=Zabbix Official Repository (non-supported)
baseurl=$almapath/el8/zabbix/zabbix-non-supported/
enabled=1
gpgcheck=0

[zabbix-agent2-plugins]
name=Zabbix Official Repository (Agent2 Plugins)
baseurl=$almapath/el8/zabbix/zabbix-agent2-plugins/
enabled=1
gpgcheck=0

[zfs]
name=ZFS on Linux for EL8 - dkms
baseurl=$almapath/el8/zfs/zfs/
enabled=1

[zfs-kmod]
name=ZFS on Linux for EL8 - kmod
baseurl=$almapath/el8/zfs/zfs-kmod/
enabled=1

[mongodb-7.0]
name=MongoDB Repository
baseurl=$almapath/el8/mongodb-7.0/
gpgcheck=0
enabled=1

[mongodb-8.0]
name=MongoDB Repository
baseurl=$almapath/el8/mongodb-8.0/
gpgcheck=0
enabled=1 

[packages-microsoft-com-mssql-server-2019]
name=packages-microsoft-com-mssql-server-2019
baseurl=$almapath/el8/microsoft/packages-microsoft-com-mssql-server-2019/
gpgcheck=0
enabled=1

[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=$almapath/el8/microsoft/packages-microsoft-com-prod/
gpgcheck=0
enabled=1

[openvpn-as-rhel8]
name=OpenVPN as packages repository for rhel8
baseurl=$almapath/el8/openvpn-as-rhel8/
gpgcheck=0
enabled=1

_EOF_`

###########

el8reposrc=`cat <<_EOF_

[bareos-source]
name=Backup Archiving Recovery Open Sourced (EL_8) - Sources
baseurl=$almapath/el8/bareos/bareos-source/
enabled=1
gpgcheck=0

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=$almapath/el8/docker/docker-ce-stable-source/
enabled=1
gpgcheck=0

[epel-source]
name=Extra Packages for Enterprise Linux 8 - Source
baseurl=$almapath/el8/epel/epel-source/
enabled=1
gpgcheck=0

[zfs-source]
name=ZFS on Linux for EL8 - Source
baseurl=$almapath/el8/zfs/zfs-source
enabled=1

[rpmfusion-free-tainted-source]
name=RPM Fusion for EL 8 - Free tainted - Source
baseurl=$almapath/el8/rpmfusion/rpmfusion-free-tainted-source/
enabled=1
type=rpm-md
gpgcheck=0

[rpmfusion-free-updates-source]
name=RPM Fusion for EL 8 - Free - Updates Source
baseurl=$almapath/el8/rpmfusion/rpmfusion-free-updates-source/
enabled=1
type=rpm-md
gpgcheck=0

[rpmfusion-nonfree-tainted-source]
name=RPM Fusion for EL 8 - Nonfree tainted - Source
baseurl=$almapath/el8/rpmfusion/rpmfusion-nonfree-tainted-source/
enabled=1
type=rpm-md
gpgcheck=1

[rpmfusion-nonfree-updates-source]
name=RPM Fusion for EL 8 - Nonfree - Updates Source
baseurl=$almapath/el8/rpmfusion/rpmfusion-nonfree-updates-source/
enabled=1
type=rpm-md
gpgcheck=0

_EOF_`

###########

el8ovirtrepo=`cat <<_EOF_

[ovirt-4.4]
name=Latest oVirt 4.4 Release
baseurl=$almapath/el8/ovirt/ovirt-4.4/
enabled=1
countme=1

[ovirt-4.4-centos-gluster8]
name=CentOS-8 - Gluster 8
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-gluster8/
enabled=1
gpgcheck=0

[ovirt-4.4-virtio-win-latest]
name=virtio-win builds roughly matching what will be shipped in upcoming RHEL
baseurl=$almapath/el8/ovirt/ovirt-4.4-virtio-win-latest/
enabled=1
gpgcheck=0

[ovirt-4.4-copr:copr.fedorainfracloud.org:sbonazzo:EL8_collection]
name=Copr repo for EL8_collection owned by sbonazzo
baseurl=$almapath/el8/ovirt/ovirt-4.4-copr.copr.fedorainfracloud.org.sbonazzo.EL8_collection/
type=rpm-md
enabled=1
enabled_metadata=1

[ovirt-4.4-copr:copr.fedorainfracloud.org:sac:gluster-ansible]
name=Copr repo for gluster-ansible owned by sac
baseurl=$almapath/el8/ovirt/ovirt-4.4-copr.copr.fedorainfracloud.org.sac.gluster-ansible/
type=rpm-md
repo_gpgcheck=0
enabled=1
enabled_metadata=1

[ovirt-4.4-centos-advanced-virtualization]
name=CentOS-$releasever - Advanced Virtualization
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-advanced-virtualization/
enabled=1
module_hotfixes=1

[ovirt-4.4-centos-ovirt44]
name=CentOS-$releasever - oVirt 4.4
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-ovirt44/
enabled=1

[ovirt-4.4-centos-opstools]
name=CentOS-8 - OpsTools - collectd
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-opstools/
enabled=1

# Temporary hack as opstools has not been populated yet
[ovirt-4.4-centos-opstools-vault]
name=CentOS-8 - OpsTools - collectd - vault
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-opstools-vault/
enabled=1

[ovirt-4.4-centos-nfv-openvswitch]
name=CentOS-$releasever - NFV OpenvSwitch
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-nfv-openvswitch/
enabled=1
module_hotfixes=1

[ovirt-4.4-centos-ceph-pacific]
name=CentOS-$stream - Ceph Pacific
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-ceph-pacific/
enabled=1


[ovirt-4.4-centos-openstack-victoria]
name=CentOS-$releasever - OpenStack victoria
baseurl=$almapath/el8/ovirt/ovirt-4.4-centos-openstack-victoria/
enabled=1
module_hotfixes=1

_EOF_`

###########

el8pgrepo=`cat <<_EOF_

[pgdg-common]
name=PostgreSQL common RPMs for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg-common/
enabled=1
gpgcheck=0

# Red Hat recently breaks compatibility between 8.n and 8.n+1. PGDG repo is
# affected with the LLVM packages. This is a band aid repo for the llvmjit users
# whose installations cannot be updated.

[pgdg-centos8-sysupdates]
name=PostgreSQL Supplementary ucommon RPMs for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg-centos8-sysupdates/
enabled=1
gpgcheck=0

# We provide extra package to support some RPMs in the PostgreSQL RPM repo, like
# consul, haproxy, etc.

[pgdg-rhel8-extras]
name=Extra packages to support some RPMs in the PostgreSQL RPM repo RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg-rhel8-extras/
enabled=1
gpgcheck=0

# PGDG Red Hat Enterprise Linux / Rocky stable repositories:

[pgdg16]
name=PostgreSQL 16 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg16/
enabled=1
gpgcheck=0

[pgdg15]
name=PostgreSQL 15 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg15/
enabled=1
gpgcheck=0

[pgdg14]
name=PostgreSQL 14 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg14/
enabled=1
gpgcheck=0

[pgdg13]
name=PostgreSQL 13 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg13/
enabled=1
gpgcheck=0

[pgdg12]
name=PostgreSQL 12 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg16/
enabled=1
gpgcheck=0

[pgdg-source-common]
name=PostgreSQL 12 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg-source-common/
enabled=1
gpgcheck=0

# PGDG RHEL / Rocky / AlmaLinux testing common SRPM repository for all PostgreSQL versions

[pgdg16-source]
name=PostgreSQL 16 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg16-source/
enabled=1
gpgcheck=0

[pgdg15-source]
name=PostgreSQL 15 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg15-source/
enabled=1
gpgcheck=0

[pgdg14-source]
name=PostgreSQL 14 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg14-source/
enabled=1
gpgcheck=0

[pgdg13-source]
name=PostgreSQL 13 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg13-source/
enabled=1
gpgcheck=0

[pgdg12-source]
name=PostgreSQL 12 for RHEL / Rocky / AlmaLinux 8.10
baseurl=$almapath/el8/postgresql/pgdg12-source/
enabled=1
gpgcheck=0

[postgrespro-std-15]
name=PostgresPro Standard 15 for rhel
baseurl=$almapath/el8/postgresql/postgrespro-std-15/
enabled=1
gpgcheck=0

[postgrespro-std-16]
name=PostgresPro Standard 16 for rhel
baseurl=$almapath/el8/postgresql/postgrespro-std-16/
enabled=1
gpgcheck=0


_EOF_`

###########


echo "$almarepo" > /etc/yum.repos.d/local.repo

echo "$almareposrc" > /etc/yum.repos.d/local-source.repo

echo "$el8repo" > /etc/yum.repos.d/local-el8repo.repo

echo "$el8reposrc" > /etc/yum.repos.d/local-el8repo-source.repo

echo "$el8ovirtrepo" > /etc/yum.repos.d/local-ovirt.repo

echo "$el8pgrepo" > /etc/yum.repos.d/local-pg.repo

