Last active
June 4, 2024 09:32
-
-
Save aleskxyz/b1b8caf2eeae28fb320bceb26a360350 to your computer and use it in GitHub Desktop.
List of Exclusively Installed Yum Packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm_list="" | |
package_list="" | |
for id in $(yum --noplugins history list all 2> /dev/null | grep -v System | sed 's/^ *//;s/ *| */|/g' | grep -E "^[0-9]+\|" | awk -F '|' '$4 == "Install" || $4 ~ /I/' | cut -d '|' -f1); do | |
result=$(yum --noplugins history info $id 2> /dev/null | awk '/Packages Altered/{flag=1; next} flag' | awk '$1 == "Install"' | awk '{print $2}') | |
if [ -n "$result" ]; then | |
rpm_list+="$result"$'\n' | |
fi | |
done | |
rpm_list=$(echo "$rpm_list" | sed '/^$/d') | |
while IFS= read -r package; do | |
package_name=$(rpm -q --queryformat '%{NAME}\n' "$package" 2>/dev/null) | |
if [ $? -eq 0 ]; then | |
package_list+="$package_name"$'\n' | |
fi | |
done <<< "$rpm_list" | |
package_list=$(echo "$package_list" | sort | uniq | sed '/^$/d') | |
echo "$package_list" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script extracts and lists packages exclusively installed via Yum package manager. It parses the Yum history to identify packages that were installed without dependencies or updates.