summary refs log tree commit diff
path: root/xcheckrestart
blob: a810f5c2a4db6fe513ecffa50876cd4a8d201c3f (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
25
26
27
#!/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 /memfd \
			-e /i915 \
			-e /run/user \
			-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