summaryrefslogtreecommitdiff
blob: d0b7c1e8ac05b2c4832bd6954849ee8ff5984bfb (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

if [ ! -e /usr/bin/qpkg ]; then
	echo "Please emerge gentoolkit before using this script."
	exit 1
fi

LINKED_WITH=libmysqlclient
rm -f /tmp/${LINKED_WITH}.*

echo "This might take a while ..."
(
	cd /
    # this is the list of locations to search
    LIST="/bin /sbin /lib /var/qmail /var/vpopmail /usr/X11R6/bin /usr/X11R6/lib /usr/bin /usr/sbin /usr/lib /usr/local/bin /usr/local/sbin /usr/local/lib /usr/qt /usr/libexec /usr/e17 /usr/kde /usr/qt /usr/libexec"
    # this is the list of limitations to apply to trim the input
    LIMITS="-type f ! -fstype proc ! -fstype tmpfs ! -fstype devfs ! -fstype usbdevfs ! -fstype ramfs ! -fstype smbfs ! -fstype devpts ! -path tmp "
    # this if any of these are true, then we want this file
    WANTED="-perm +111 -or -name '*.so' -or -name '*.so.*' -or -name '*.a' -or -name '*.a.*'"
   
	for i in ` find $LIST \(  $WANTED \) $LIMITS 2>/dev/null | sort | uniq `
	do
		ldd $i 2>/dev/null | grep ${LINKED_WITH} >/dev/null 2>&1
		[ $? -eq 0 ] && {
			qpkg -nc -f `echo $i | sed -e 's|^\.||'` >>/tmp/${LINKED_WITH}.pkgs
			echo "`echo $i | sed -e 's|^\.||'` is linked to ${LINKED_WITH} ..."
			ldd $i
			echo "---"
			echo ""
		}
	done
) | sed -e "s|\(.*\)\(${LINKED_WITH}\)\(.*\)\(=>\)|-->\1\2\3\4|" >>/tmp/${LINKED_WITH}.hits
    
cat /tmp/${LINKED_WITH}.pkgs | sort | uniq | sed 's:\(.*/.*\)-[0-9]\+.*:\1:g' \
	>>/tmp/${LINKED_WITH}.rebuildme

echo "You will need to rebuild the following packages:"
echo "------------"
cat /tmp/${LINKED_WITH}.rebuildme | grep -v "dev-db/mysql"
echo "------------"