Skip to content

Update Apt Support - Fixes #217#218

Merged
albatrossflavour merged 3 commits into
voxpupuli:developmentfrom
AMDHome:development
Feb 14, 2023
Merged

Update Apt Support - Fixes #217#218
albatrossflavour merged 3 commits into
voxpupuli:developmentfrom
AMDHome:development

Conversation

@AMDHome

@AMDHome AMDHome commented Sep 2, 2022

Copy link
Copy Markdown
Contributor

Apt requires users to run apt update to update the package list. Without this, there will never be any updates for apt upgrade to upgrade.

@AMDHome AMDHome changed the title Update apt package list during fact gen (#217) Update Apt Support Sep 2, 2022
@AMDHome

AMDHome commented Sep 2, 2022

Copy link
Copy Markdown
Contributor Author

There are two changes in this PR:

  1. Update apt package list during fact generation (The os_patching_fact_generation.sh does not run apt update #217). Apt requires users to run apt update to update the package list. Without this, there will never be any updates for apt upgrade to upgrade.

  2. Different distros/repos can use different casing for the S in security (uppercase vs lowercase). awk is usually case sensitive which means depending on your distro, security apps could be marked as non-security related updates with this script. Making awk case insensitive resolves this issue.

For instance:
Debian (Capital S in Security):

root@amdhome-pve:~# apt upgrade -s 2>/dev/null | grep Inst | grep ecurity
Inst curl [7.64.0-4+deb10u2] (7.64.0-4+deb10u3 Debian-Security:10/oldstable [amd64]) []
Inst libcurl4 [7.64.0-4+deb10u2] (7.64.0-4+deb10u3 Debian-Security:10/oldstable [amd64])
Inst libcurl3-gnutls [7.64.0-4+deb10u2] (7.64.0-4+deb10u3 Debian-Security:10/oldstable [amd64])

Ubuntu (Lowercase s in security):

root@puppet-master:~# apt upgrade -s 2>/dev/null | grep Inst | grep ecurity
Inst curl [7.58.0-2ubuntu3.19] (7.58.0-2ubuntu3.20 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64]) []
Inst libcurl4 [7.58.0-2ubuntu3.19] (7.58.0-2ubuntu3.20 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])
Inst libcurl3-gnutls [7.58.0-2ubuntu3.19] (7.58.0-2ubuntu3.20 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])

The changes in the PR:
Debian:

root@amdhome-pve:~# apt upgrade -s 2>/dev/null | awk '$1 == "Inst" && /Security/ {print $2}'
curl
libcurl4
libcurl3-gnutls
root@amdhome-pve:~# apt upgrade -s 2>/dev/null | awk 'BEGIN {IGNORECASE = 1}; $1 == "Inst" && /Security/ {print $2}'
curl
libcurl4
libcurl3-gnutls

Ubuntu:

root@puppet-master:~# apt upgrade -s 2>/dev/null | awk '$1 == "Inst" && /Security/ {print $2}'
root@puppet-master:~# apt upgrade -s 2>/dev/null | awk 'BEGIN {IGNORECASE = 1}; $1 == "Inst" && /Security/ {print $2}'
curl
libcurl4
libcurl3-gnutls

@AMDHome AMDHome changed the title Update Apt Support Update Apt Support - Fixes #217 Sep 21, 2022
@albatrossflavour

Copy link
Copy Markdown
Collaborator

Really well-documented PR. I've rebased it and merged it. Thanks

@albatrossflavour
albatrossflavour merged commit 7db49d0 into voxpupuli:development Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants