#!/bin/bash SOURCE="$1" not_in_list() { local deplist="$1" local dep="$2" local i for i in ${deplist} do [[ ${i} = ${dep} ]] && return 1 done return 0 } echo -n "resolving linking lib ... " # first binaries: for bin in $(find ${SOURCE} | xargs file | grep "executable" | grep ELF | cut -f 1 -d :) \ $(find ${SOURCE} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d :) do while read lib do dep=$(echo "${lib}" | cut -d'>' -f2 | cut -d'(' -f1 | sed "s:\ ::g") if [[ ${X11HACK} = true ]] then dep=$(echo ${dep} | sed "s:/usr/X11R6/:/usr/:g") fi if [[ -z $(echo ${dep} | grep "notfound") ]] then if not_in_list "${ALL_DEPS}" "${dep}" then ALL_DEPS="${ALL_DEPS} ${dep}" fi fi done << EOF $(ldd ${bin}) EOF done echo "done" if [[ ${DEBUG} = true ]] then echo for i in $(echo ${ALL_DEPS} | sort ) do echo ${i} done echo fi echo -n "resolving packages ... " for i in ${ALL_DEPS} do pkg=$(/sbin/magequery -f "${i}") for z in ${pkg} do if not_in_list "${ALL_PACKAGES}" "${z}" then ALL_PACKAGES="${ALL_PACKAGES} ${z}" [[ ${DEBUG} = true ]] && echo "DEBUG: ${z} ${i}" fi done done echo "done" echo for i in ${ALL_PACKAGES} do echo "${i}" done | sort echo