about summary refs log tree commit diff
path: root/xcheckrestart
blob: 1e26318fcba5b3c1be68c586c5cb73f599187352 (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
28
#!/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 ' [r-][w-][x-]p .*    *\K    .* \(deleted\)$' $f/maps 2>/dev/null |
		grep -v -e /SYSV \
			-e /.cache/fontconfig \
			-e /var/cache/fontconfig \
			-e /usr/share/glib-2.0/schemas/gschemas.compiled \
			-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