Modify the sed filter to remove PIC addresses and ignore the first line which will always be the vdso. Also remove the tls filter, as glibc has had threaded support mainlined for many years now. If a user has a glibc this old, we don't have support for them elsewhere (udev, kernel). We also cleanup the logical flow through this function and remove a lot of cruft that would always return true, or that didn't quite make sense. Signed-off-by: Dave Reisner <d@falconindy.com> --- functions | 48 +++++++++++++++++------------------------------- 1 files changed, 17 insertions(+), 31 deletions(-) diff --git a/functions b/functions index 5551843..9adb5f8 100644 --- a/functions +++ b/functions @@ -153,7 +153,7 @@ add_file () add_symlink "${fil}" "${lnk}" fil="${lnk}" fi - if [ $# -eq 2 ]; then + if [[ $2 ]]; then dest="${2}" else dest="${fil##$BASEDIR}" @@ -223,47 +223,33 @@ add_module () add_binary () { local bin dest type lib - bin=$(which "${1}") - if [ $? -ne 0 ]; then - bin="${1}" - fi - dest="" - if [ $# -eq 2 ]; then - dest=${2} - fi + bin=$(type -P "$1") + dest=$2 - if [ ! -f "${bin}" ]; then - err "'${bin}' is not a file" + if [[ ! -f "$bin" ]]; then + err "'$bin' is not a file" return 1 fi - if [ $? -eq 0 ]; then - type=$(file -b "${bin}") - case "${type}" in - *script*) + case "$(file -b "$bin")" in + *script*) msg " adding '${type}' script, ensure proper interp exists..." - add_file "${bin}" ${dest} + add_file "$bin" $dest ;; - *executable*|*shared\ object*|*symbolic\ link*) - add_file "${bin}" ${dest} - #note, this will also handle 'not a dynamic executable' spit out by - # static binaries... the deps will produce nothing - for lib in $(ldd ${bin} 2>/dev/null | sed "s|.*=>\(.*\)|\1|"); do - if [ -n "${lib}" ]; then - #remove TLS libraries - notls=$(echo ${lib} | sed 's|/lib/tls.*/\(lib.*\)|/lib/\1|') - [ -e "${notls}" ] && lib="${notls}" - [ -f "${lib}" ] && add_file "${lib}" - fi + *executable*|*shared\ object*|*symbolic\ link*) + add_file "$bin" "$dest" + # note, this will also handle 'not a dynamic executable' spit out + # by static binaries... the deps will produce nothing + for lib in $(ldd "$bin" 2>/dev/null | sed '1d;s|.*=>\(.*\)|\1|;s/(0x[0-9a-f]\+)//'); do + [[ -f "$lib" ]] && add_file "$lib" done ;; - *) - err "unknown type '${type}' for binary '${bin}'" + *) + err "unknown type '$type' for binary '$bin'" return 1 ;; - esac - fi + esac } parse_hook () -- 1.7.5.4