Commit a62e091d authored by root's avatar root

Improved check for security updates on Fedora systems

parent c19eabde
......@@ -166,22 +166,29 @@ UbuntuSecurityPackages() {
}
FedoraSecurityPackages() {
AvailableSecurityPatches="$(yum --security check-update 2>/dev/null | awk '/ package/,/Obsoleting/' | egrep -v "^Obsoleting|^[0-9]* package|^$|^No packages needed for security")"
#AvailableSecurityPatches="$(yum --security check-update 2>/dev/null | awk '/ package/,/Obsoleting/' | egrep -v "^Obsoleting|^[0-9]* package|^$|^No packages needed for security")"
TempFile=$(mktemp)
yum --security check-update 2>/dev/null | awk '/ package/,/Obsoleting/' | egrep -v "^Obsoleting|^[0-9]* package|^$|^No packages needed for security" > "$TempFile"
# List of: name.arch [epoch:]version-release repo or @installed-from-repo
# MariaDB-client.x86_64 10.4.20-1.el7.centos mariadb
# MariaDB-common.x86_64 10.4.20-1.el7.centos mariadb
# If there is anything, we need to know the current package
if [ -n "$AvailableSecurityPatches" ]; then
# If the exit code for the first command is 100, there are sequrity updates (PIPESTATUS[0] is *way* cool!)
if [ ${PIPESTATUS[0]} -eq 100 ]; then
Ret=$'\n'
SecurityPatches=""
while read Package NewVersion Repo; do
exec 5<"$TempFile"
while read -u 5 Package NewVersion Repo
do
# Get the current version of the new package
CurrentVersion="$(yum info "$Package" | egrep "^Version" | head -1 | awk '{print $NF}')"
# Assemble the string
SecurityPatches+="${Package} ${Repo} ${CurrentVersion} x86_64 ${NewVersion%-*}${Ret}"
done <<< "$AvailableSecurityPatches"
#done <<< "$AvailableSecurityPatches"
done
SecurityPatches="$(echo "$SecurityPatches" | egrep -v "^$")"
fi
rm -f "$TempFile"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment