-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos_patch_audit.sh
More file actions
executable file
·41 lines (34 loc) · 1.1 KB
/
os_patch_audit.sh
File metadata and controls
executable file
·41 lines (34 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -euo pipefail
# os_patch_audit.sh
# Reports pending package updates and security update indicators.
if command -v apt-get >/dev/null 2>&1; then
echo "Detected apt-based system"
echo "Updating package index..."
sudo apt-get update -y >/dev/null
echo
echo "Upgradable packages:"
apt list --upgradable 2>/dev/null | tail -n +2 || true
if command -v unattended-upgrade >/dev/null 2>&1; then
echo
echo "Unattended upgrades dry-run summary:"
sudo unattended-upgrade --dry-run --debug | grep -E 'Packages that will be upgraded|No packages found' || true
fi
elif command -v dnf >/dev/null 2>&1; then
echo "Detected dnf-based system"
echo "Available updates:"
sudo dnf check-update || true
echo
echo "Security updates:"
sudo dnf updateinfo list security || true
elif command -v yum >/dev/null 2>&1; then
echo "Detected yum-based system"
echo "Available updates:"
sudo yum check-update || true
echo
echo "Security updates:"
sudo yum updateinfo list security all || true
else
echo "Unsupported package manager (apt/dnf/yum not found)."
exit 1
fi