summaryrefslogtreecommitdiff
path: root/.local/bin/who-depends
blob: d1fb0c22a95c7d4dece3125988dbc319381a6285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

# Script that takes a package as an argument and returns installed packages
# that are dependent on it

[ $# -eq 1 ] || echo "usage: who-depends package"
apt list --installed | tail -n+2 | cut -d '/' -f 1 > /tmp/whodepends
pkg="$1"
deps_all=$(apt-cache rdepends $pkg | tail -n+3 | sed "s/^\s*//")
for dep in $deps_all
do
		grep -lq "$dep" /tmp/whodepends && echo "$dep"
done