Коды выхода ошибки не возвращаются в CentOS 7.7.1908 для `yum update` - PullRequest
0 голосов
/ 29 апреля 2020

Я пытаюсь обойти ошибку [Errno -1] Metadata file does not match checksum на yum update, создав повторную попытку l oop, но по какой-то причине yum возвращается с 0 каждый раз.

Вот последовательность:

#!/bin/bash

# Create a copy of the yum.conf file and set "http_caching=none"
cp /etc/yum.conf /tmp/yum.conf
sed -i 's/http_caching=packages/http_caching=none/g' /tmp/yum.conf
# Add an additional "http_caching=none" line in case the file does not already contain an "http_caching" property
echo -e "\nhttp_caching=none" >> /tmp/yum.conf

# Clear local caches
yum clean all --config=/tmp/yum.conf --disableplugin=fastestmirror
yum clean metadata --config=/tmp/yum.conf --disableplugin=fastestmirror
rm -fr /var/cache/yum

# Run update
yum update -y --config=/tmp/yum.conf --disableplugin=fastestmirror 2>&1
result=$?

echo $result

Несмотря на это в результатах:

Loaded plugins: langpacks
http://olcentgbl.trafficmanager.net/centos/7/os/x86_64/repodata/primary.sqlite.bz2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
No packages marked for update

Переменная $result содержит значение 0, а повтор l oop равен не повторяется. Если 2>&1 не включено, сообщение отправляется на stderr, поэтому должен быть возвращен код завершения сбоя.

Есть идеи, почему yum не возвращает ожидаемый результат?

Любое понимание очень ценится.

Спасибо!

...