Last active
July 14, 2024 01:09
-
-
Save tuananh/1e8e0f921410a830a7cd1161ff8bb189 to your computer and use it in GitHub Desktop.
apt find recursive dependencies of 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
#!/bin/bash | |
set -eu | |
declare -a all_deps=( ) | |
for pkg_name in "$@" | |
do | |
declare -a deps=$(apt-cache depends -i --recurse $pkg_name | awk -F 'Depends: ' 'NF>1{ sub(/ .*/,"",$NF); print $NF }' | sort | uniq) | |
all_deps+=$deps | |
done | |
printf '%s\n' "${all_deps[@]}" | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It shows virtual packages instead of resolving them, how to do it?