about summary refs log tree commit diff
path: root/xcheckrestart
blob: fe45c15a5798558b800dd8dd1f3e62f5a610452b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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 /dev/shm \
			-e /home \
			-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