summaryrefslogtreecommitdiffstats
path: root/sogrep
blob: e9b3b0b2ff37fe23e5752f20fff02d2be85c3d95 (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
#!/bin/bash

home="$(dirname "${0}")"
target="${home}/repo"
tmp=$(mktemp -d)
arches=('i686' 'x86_64')
lock='/tmp/mirrorsync.lck'

[ -f "${lock}" ] && exit 1

if [ $# -ne 2 ]; then
	echo "usage: $(basename $0) <repo> <soname>"
	exit 1
fi

repo="${1}"
lib="${2}"

for arch in ${arches[@]}; do
	db=${target}/${repo}/os/${arch}/${repo}.links.tar.gz
	if [ -f ${db} ]; then
		mkdir -p ${tmp}/${repo}/${arch}
		bsdtar -xf ${db} -C ${tmp}/${repo}/${arch}
	fi
done

for i in $(grep -rl "${lib}" ${tmp}); do
	pkg=$(basename $(dirname $i))
	echo ${pkg%-*-*}
done | sort -u

rm -rf ${tmp}