summaryrefslogtreecommitdiffstats
path: root/sogrep
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-04-10 02:33:02 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-04-10 02:33:02 +0200
commitce1d818e401e640dea188926ab66b7113d0c067f (patch)
tree7a3795071fb62ca62700a11a845cebe06f16214a /sogrep
downloadrepo-tools-ce1d818e401e640dea188926ab66b7113d0c067f.tar.gz
repo-tools-ce1d818e401e640dea188926ab66b7113d0c067f.tar.xz
initial commit
Diffstat (limited to 'sogrep')
-rwxr-xr-xsogrep35
1 files changed, 35 insertions, 0 deletions
diff --git a/sogrep b/sogrep
new file mode 100755
index 0000000..b80d66f
--- /dev/null
+++ b/sogrep
@@ -0,0 +1,35 @@
+#!/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}
+ else
+ echo "${db} not found!"
+ exit 1
+ fi
+done
+
+for i in $(grep -rl "${lib}" ${tmp}); do
+ pkg=$(basename $(dirname $i))
+ echo ${pkg%-*-*}
+done | sort -u
+
+rm -rf ${tmp}