From 5d236667db593089aa6fec791ce31b442e1a049e Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 11 Mar 2014 17:03:23 +0100 Subject: [binutil.inc] fix special case: if link exists but target does not, check if the target exists in the MODULE_BUILD_DIR and if so, add "./target" to copylist. --- remote/includes/binutil.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'remote/includes') diff --git a/remote/includes/binutil.inc b/remote/includes/binutil.inc index 906b6cc2..73371c25 100644 --- a/remote/includes/binutil.inc +++ b/remote/includes/binutil.inc @@ -136,12 +136,14 @@ get_link_chain() { # sanity checks if [[ "$1" == /* ]]; then - [ -e $1 ] || perror "get_link_chain: no such file: $1" + if [ ! -e $1 -a ! -L $1 ]; then + perror "'$1' is a link but its target '$LINK_TARGET' is not in '${LOCALSEARCHDIR}'" + fi else perror "get_link_chain() requires absolute paths, given: $1" fi if [ $# == 2 ] ; then - [ ! -d $2 ] && perror "get_link_chain: $2 is not a directory." + [ ! -d $2 ] && perror "get_link_chain: '$2' is not a directory. Local search can't work..." # got a prefix local PREFIX=$(readlink -f $2) else @@ -184,7 +186,11 @@ get_link_chain() { if [ "x$PREFIX" != "x" -a "x$PREFIX" != "xnotset" ]; then if [ "x${LINK#$PREFIX}" == "x${LINK}" ]; then # prefix was not in the link - echo "$LINK" + if [ ! -e "$LINK" ]; then + [ -e "$PREFIX/$LINK" ] && echo "./$LINK" + else + echo "$LINK" + fi else # prefix was in the link echo ./"${LINK#$PREFIX}" @@ -206,8 +212,7 @@ get_link_chain() { # - libc.so, ld-linux.so # list_basic_libs() { - for i in $(ldd ${SHELL}) - do + for i in $(ldd ${SHELL}); do [ $(echo $i | grep '^/' | grep -c ld) -eq 1 -o $(echo $i | grep '^/' | grep -c libc.so) -eq 1 ] && get_link_chain $i done } -- cgit v1.2.3-55-g7522