echo Update script started at $(date) >> /var/log/update-repository.log
reposync -p /var/www/html/rhel8/baseOS --download-metadata --repo=rhel-8-for-x86_64-baseos-rpms
createrepo -v /var/www/html/rhel8/baseOS/
reposync -p /var/www/html/rhel8/AppStream --download-metadata --repo=rhel-8-for-x86_64-appstream-rpms
createrepo -v /var/www/html/rhel8/AppStream/
rm -rf /var/www/html/rhel8/AppStream/repodata/*updateinfo*
cp /var/cache/dnf/rhel-8-for-x86_64-appstream-rpms-31f38ae8d1273bf6/repodata/*-updateinfo.xml.gz /var/www/html/rhel8/AppStream/repodata/
gzip -d /var/www/html/rhel8/AppStream/repodata/*-updateinfo.xml.gz
mv /var/www/html/rhel8/AppStream/repodata/*-updateinfo.xml /var/www/html/rhel8/AppStream/repodata/updateinfo.xml
modifyrepo /var/www/html/rhel8/AppStream/repodata/updateinfo.xml /var/www/html/rhel8/AppStream/repodata/
rm -rf /var/www/html/rhel8/baseOS/repodata/*updateinfo*
cp /var/cache/dnf/rhel-8-for-x86_64-baseos-rpms-952f66ddc95498fa/repodata/*-updateinfo.xml.gz /var/www/html/rhel8/baseOS/repodata/
gzip -d /var/www/html/rhel8/baseOS/repodata/*-updateinfo.xml.gz
mv /var/www/html/rhel8/baseOS/repodata/*-updateinfo.xml /var/www/html/rhel8/baseOS/repodata/updateinfo.xml
modifyrepo /var/www/html/rhel8/baseOS/repodata/updateinfo.xml /var/www/html/rhel8/baseOS/repodata/

echo Update script ended at $(date) >> /var/log/update-repository.log
