rhel sync: make sure errors go to stderr so we see them

Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
Kevin Fenzi 2022-07-14 16:22:27 -07:00
parent 9dde1370d0
commit ff52cbd435
3 changed files with 9 additions and 8 deletions

View file

@ -17,6 +17,7 @@ done
cd $RHEL7SYNCDIR cd $RHEL7SYNCDIR
echoerr() { printf "%s\n" "$*" >&2; }
## ##
## Sync out RHEL-7 for appropriate arches ## Sync out RHEL-7 for appropriate arches
for A in ${ARCHES}; do for A in ${ARCHES}; do
@ -36,14 +37,14 @@ for A in ${ARCHES}; do
echo "Syncing ${R} for ${A}" echo "Syncing ${R} for ${A}"
dnf reposync -c ${RHEL7SYNCDIR}/${CONF} ${DNFOPTS} --repoid ${R} ${DNF_ARCH} --metadata-path ${YUMDIR}/${A} dnf reposync -c ${RHEL7SYNCDIR}/${CONF} ${DNFOPTS} --repoid ${R} ${DNF_ARCH} --metadata-path ${YUMDIR}/${A}
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Something went wrong with reposync -c ${RHEL7SYNCDIR}/${CONF} ${DNFOPTS} --repoid ${R} ${DNF_ARCH} --metadata-path ${YUMDIR}/${A}" echoerr "Something went wrong with reposync -c ${RHEL7SYNCDIR}/${CONF} ${DNFOPTS} --repoid ${R} ${DNF_ARCH} --metadata-path ${YUMDIR}/${A}"
continue continue
fi fi
## Try to create repo ## Try to create repo
pushd ${RHEL7SYNCDIR}/${A}/${R} &> /dev/null pushd ${RHEL7SYNCDIR}/${A}/${R} &> /dev/null
createrepo_c -q --update --workers 6 . createrepo_c -q --update --workers 6 .
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Something went wrong with createrepo ${A} ${R}" echoerr "Something went wrong with createrepo ${A} ${R}"
continue continue
fi fi
popd &> /dev/null popd &> /dev/null

View file

@ -11,7 +11,7 @@ DNFOPTS='--download-metadata -m --setopt=module_platform_id="platform:el8"'
# Need to set the arches we are going to sync down # Need to set the arches we are going to sync down
ARCHES="aarch64 ppc64le s390x x86_64" ARCHES="aarch64 ppc64le s390x x86_64"
echoerr() { printf "%s\n" "$*" >&2; }
## ##
# Do the deeds # Do the deeds
cd ${RHEL8SYNCDIR} cd ${RHEL8SYNCDIR}
@ -43,7 +43,7 @@ for A in ${ARCHES}; do
echo "Syncing ${R} for ${A}" echo "Syncing ${R} for ${A}"
# Be verbose on errors. # Be verbose on errors.
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Something went wrong with reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}" echoerr "Something went wrong with reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}"
fi fi
# x86_64 is 'special' because we have to tell it for i686 also. # x86_64 is 'special' because we have to tell it for i686 also.
if [[ ${A} == 'x86_64' ]]; then if [[ ${A} == 'x86_64' ]]; then
@ -52,7 +52,7 @@ for A in ${ARCHES}; do
dnf reposync -c ${RHEL8SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -p ${A} &> /dev/null dnf reposync -c ${RHEL8SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -p ${A} &> /dev/null
fi fi
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Something went wrong with dnf reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}" echoerr "Something went wrong with dnf reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}"
fi fi
done done
done done

View file

@ -11,7 +11,7 @@ DNFOPTS='--download-metadata -m --setopt=module_platform_id="platform:el9"'
# Need to set the arches we are going to sync down # Need to set the arches we are going to sync down
ARCHES="aarch64 ppc64le s390x x86_64" ARCHES="aarch64 ppc64le s390x x86_64"
echoerr() { printf "%s\n" "$*" >&2; }
## ##
# Do the deeds # Do the deeds
cd ${RHEL9SYNCDIR} cd ${RHEL9SYNCDIR}
@ -43,7 +43,7 @@ for A in ${ARCHES}; do
echo "Syncing ${R} for ${A}" echo "Syncing ${R} for ${A}"
# Be verbose on errors. # Be verbose on errors.
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Something went wrong with reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}" echoerr "Something went wrong with reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}"
fi fi
# x86_64 is 'special' because we have to tell it for i686 also. # x86_64 is 'special' because we have to tell it for i686 also.
if [[ ${A} == 'x86_64' ]]; then if [[ ${A} == 'x86_64' ]]; then
@ -52,7 +52,7 @@ for A in ${ARCHES}; do
dnf reposync -c ${RHEL9SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -p ${A} &> /dev/null dnf reposync -c ${RHEL9SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -p ${A} &> /dev/null
fi fi
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "Something went wrong with dnf reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}" echoerr "Something went wrong with dnf reposync -c ${RHEL9SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}"
fi fi
done done
done done