toolkit/iso/empanadas/empanadas/templates/reposync-src.tmpl
Louis Abel 8017026bc8
Add a final grep to log for "FAILED" (RLBT#0000138)
Add a final grep if exit code of reposync is 0. There are cases where
dnf reposync will say the sync succeeded despite not downloading a
package due to a failed mirror. It is a failure when a GPG key can't be
verified or some other unforeseen cirumstance... but not when a package
can't be downloaded because of "all mirrors tried"

Also added "time" to the fpsync commands for RL9 syncing.
2022-07-12 00:59:19 -07:00

26 lines
634 B
Bash

#!/bin/bash
set -o pipefail
{{ import_gpg_cmd }} | tee -a {{ sync_log }}
{{ dnf_plugin_cmd }} | tee -a {{ sync_log }}
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/*.repo
{{ 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
exit 0
fi
fi
# {{ check_cmd }} | tee -a {{ sync_log }}