toolkit/iso/empanadas/empanadas/templates/reposync.tmpl

40 lines
1.1 KiB
Bash

#!/bin/bash
set -o pipefail
{{ import_gpg_cmd }} | tee -a {{ sync_log }}
{{ arch_force_cp }} | tee -a {{ sync_log }}
{{ dnf_plugin_cmd }} | tee -a {{ sync_log }}
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/*.repo
{{ metadata_cmd }} | tee -a {{ sync_log }}
{{ sync_cmd }} | tee -a {{ sync_log }}
# Yes this is a bit hacky. Can't think of a better way to do this.
ret_val=$?
if [ "$ret_val" -ne 0 ]; then
echo "SYNCING FAILED" | tee -a {{ sync_log }}
exit 1
fi
if [ "$ret_val" -eq 0 ]; then
recs=$(grep '\[FAILED\]' {{ sync_log }})
if [[ -n "${recs}" ]]; then
echo "SOME PACKAGES DID NOT DOWNLOAD" | tee -a {{ sync_log }}
exit 1
else
# This is kind of a hack too.
#FOUND=$(grep -A20 'git\.rockylinux\.org' {{ sync_log }} | egrep -c '^\([0-9]+\/[0-9]+\)|\[SKIPPED\]|\.rpm')
#if [ "$FOUND" -eq "0" ]; then
# echo "Repository is empty." | tee -a {{ sync_log }}
# rm -rf {{ download_path }}
#fi
{%- if deploy_extra_files %}
pushd {{ download_path }}
curl -RO {{ gpg_key_url }}
popd
{% endif %}
exit 0
fi
fi
# {{ check_cmd }} | tee -a {{ sync_log }}