diff options
Diffstat (limited to 'revdep')
| -rwxr-xr-x | revdep | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -5,22 +5,40 @@ TMPFILE=$(mktemp) trap 'rm -f $TMPFILE; printf "\033[0K"; exit 1' 1 2 3 15 +while [ "$1" ]; do + case $1 in + -v) verbose=1;; + -h) help=1;; + esac + shift +done + find $SEARCH_DIRS -type f \( -perm /+u+x -o -name '*.so' -o -name '*.so.*' \) -print 2> /dev/null | sort -u > $TMPFILE total=$(wc -l $TMPFILE | awk '{print $1}') count=0 while read -r line; do count=$(( count + 1 )) libname=${line##*/} - printf " $(( 100*count/total ))%% $libname\033[0K\r" + if [ "$verbose" ]; then + printf " $(( 100*count/total ))%% $libname\033[0K\r" + fi case "$(file -bi "$line")" in *application/x-sharedlib* | *application/x-executable* | *application/x-pie-executable*) missinglib=$(ldd /$line 2>&1 | grep "Error loading shared library" | awk '{print $5}' | sed 's/://' | sort | uniq) + #missinglib=$(ldd /$line 2>&1 | grep "not found" | awk '{print $1}' | sort | uniq) if [ "$missinglib" ]; then for i in $missinglib; do objdump -p /$line | grep NEEDED | awk '{print $2}' | grep -qx $i && { - ownby=$(spm -o $line | tail -n+2 | head -n1 | awk '{print $1}') + ownby=$(spm -o $line | head -n1 | awk '{print $1}') [ "$ownby" ] || continue - echo " $ownby: $line (requires $i)" + if [ "$verbose" ]; then + echo " $ownby: $line (requires $i)" + else + echo "$p" | tr ' ' '\n' | grep -xq $ownby || { + echo $ownby + p="$p $ownby" + } + fi } done fi;; |