about summary refs log tree commit diff
path: root/xcheckrestart
blob: a5d220ec9f8c4c6aff969a5b0a7114c87b6d8670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# xcheckrestart [-v] - list programs using outdated libraries

verbose=false
[ "$1" = -v ] && verbose=true

for f in /proc/[0-9]*; do
	LIBS=$(grep -Po '    *\K    .* \(deleted\)$' $f/maps 2>/dev/null |
		grep -v -e /SYSV \
			-e /.cache/fontconfig \
			-e /var/cache/fontconfig \
			-e 'drm mm object' |
	       	sort -u )
	if [ "$LIBS" ]; then
		EXE=$(readlink $f/exe)
		PKG=$(xbps-query -o "${EXE% (deleted)}")
		PKG=${PKG%%:*}
		PKG=${PKG%-*}
		printf '%d %s (%s)\n' ${f#/proc/} "$EXE" "$PKG"
		$verbose && printf '%s\n' "$LIBS"
	fi
done