Skip to content

Instantly share code, notes, and snippets.

@izaac
Created August 9, 2025 17:07
Show Gist options
  • Save izaac/6c97602600a4d5fdd9b39f378136162b to your computer and use it in GitHub Desktop.
Save izaac/6c97602600a4d5fdd9b39f378136162b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Ensure we have the necessary tools
if ! command -v equery &>/dev/null; then
echo "Error: app-portage/gentoolkit is not installed."
echo "Please run: sudo emerge --ask app-portage/gentoolkit"
exit 1
fi
declare -a source_pkgs
declare -a binary_pkgs
echo "Querying Portage database..."
for pkg in $(equery list '*'); do
size_file="/var/db/pkg/$pkg/SIZE"
if [[ -f "$size_file" ]]; then
if [[ $(<$size_file) -eq 0 ]]; then
binary_pkgs+=("$pkg")
else
source_pkgs+=("$pkg")
fi
fi
done
echo -e "\n--- 📦 Packages Installed from Binary ---"
printf '%s\n' "${binary_pkgs[@]}"
echo -e "\n--- 📜 Packages Installed from Source ---"
printf '%s\n' "${source_pkgs[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment