summaryrefslogtreecommitdiffstats
path: root/remote/setup_tools
diff options
context:
space:
mode:
authorJonathan Bauer2013-02-25 17:57:05 +0100
committerJonathan Bauer2013-02-25 17:57:05 +0100
commit919186998eb8cb98ad138f438ece00aec832b810 (patch)
treee6ae5fcc5ae492a55a9e7945b94da04153cb6c17 /remote/setup_tools
parentMerge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff)
downloadtm-scripts-919186998eb8cb98ad138f438ece00aec832b810.tar.gz
tm-scripts-919186998eb8cb98ad138f438ece00aec832b810.tar.xz
tm-scripts-919186998eb8cb98ad138f438ece00aec832b810.zip
binutil external binary functions
Diffstat (limited to 'remote/setup_tools')
-rwxr-xr-xremote/setup_tools127
1 files changed, 79 insertions, 48 deletions
diff --git a/remote/setup_tools b/remote/setup_tools
index 67099197..76f163f5 100755
--- a/remote/setup_tools
+++ b/remote/setup_tools
@@ -47,24 +47,59 @@ copyfileswithdependencies ()
[ ! -z "${REQUIRED_BINARIES}" ] && pinfo "Gathering required binaries from config file..."
for FILENAME in ${REQUIRED_BINARIES}
do
- FILE=$(find . -name ${FILENAME} -type f -executable | xargs grep -l '^.ELF'|head -1) # FIXME: What happens on multiple matches? Maybe add " | head -1"
- if [ -z "$FILE" ]; then
- pwarning "\tNo Binary found for ${FILENAME}. Skipping."
- continue
+ FILE=$(find . -name ${FILENAME} -type f -executable | xargs grep -l '^.ELF') # FIXME: What happens on multiple matches? Maybe add " | head -1"
+ if [ -z "$FILE" ]; then
+ pwarning "\tNo Binary found for ${FILENAME}. Skipping."
+ continue
+ fi
+ pdebug "\tFound ${FILENAME} at ${FILE}"
+ echo "${FILE}" >> "${COPYFILES_LIST}"
+ # fetch dependencies
+ # quick fix to exclude libc*, else it copies unneeded libs...
+ # workaround for
+ ldd ${FILE} &>/dev/null
+ ldd_exit_code=$?
+ if [ "x$ldd_exit_code" != "x0" ];
+ then
+ pdebug "\tldd $FILE failed."
+ continue
+ fi
+ for i in $(ldd "${FILE}" | awk '{print $1 $2 $3}' | grep -v ld-linux | grep -v libc.so | grep -v linux-gate | grep -v linux-vdso)
+ do
+ arrIN=(${i//=>/ })
+ pdebug "* ${arrIN[0]}"
+ LOCAL_MATCHES=$(find . -name "$(echo ${arrIN[0]} | awk -F '.' '{print $1}')".so\*)
+ if [ "x${LOCAL_MATCHES}" != "x" ];
+ then
+ for llib in ${LOCAL_MATCHES};
+ do
+ pdebug " at ${llib}"
+ echo ${llib} >> "${COPYFILES_LIST}"
+ done
+ else
+ if [ -e ${arrIN[1]} ];
+ then
+ echo ${arrIN[1]} >> "${COPYFILES_LIST}"
+
+ if [ ! -L ${arrIN[1]} ];
+ then
+ pdebug " at ${arrIN[1]}"
+ else
+ pdebug " at ${arrIN[1]} -> $(readlink -f ${arrIN[1]})"
+ echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST}
+ fi
+ fi
fi
- pdebug "\tFound ${FILENAME} at ${FILE}"
- echo "${FILE}" >> "${COPYFILES_LIST}"
- get_dynamic_dependencies -l "${TOOL_DIR}/${TOOL}/build" "$FILE" >> "${COPYFILES_LIST}"
+ done
done
[ ! -z "${REQUIRED_LIBRARIES}" ] && pinfo "Gathering required libraries from config file..."
for LIB in ${REQUIRED_LIBRARIES}
do
- for LOCATION in $(find . -name ${LIB})
+ for LOCATION in $(find . -name ${LIB}*)
do
pdebug "* $LOCATION"
- echo "${LOCATION}" >> ${COPYFILES_LIST}
- get_dynamic_dependencies -l "${TOOL_DIR}/${TOOL}/build" ${LOCATION} >> ${COPYFILES_LIST}
+ echo ${LOCATION} >> ${COPYFILES_LIST}
done
done
@@ -74,39 +109,34 @@ copyfileswithdependencies ()
do
pdebug "* ./$ENTRY"
echo "./${ENTRY}" >> "${COPYFILES_LIST}"
- get_dynamic_dependencies -l "${TOOL_DIR}/${TOOL}/build" ${ENTRY} >> ${COPYFILES_LIST}
-
-
- #as as \n
- #echo "./${ENTRY}" >> "${COPYFILES_LIST}"
- #for BIN in $(find "./${ENTRY}" -type f -not -name '*.a' | xargs grep -l '^.ELF')
- #do
- # pdebug " Searching libs for ${BIN}..."
-# for i in $(ldd ${BIN} | awk '{print $1 $2 $3}' | grep -v ld-linux | grep -v libc.so | grep -v linux-gate | grep -v linux-vdso)
-# do
-# arrIN=(${i//=>/ })
-# pdebug " Searching for ${arrIN[0]}...($i)"
-# local LOCAL_MATCHES=$(find . -name "$(echo ${arrIN[0]} | awk -F '.' '{print $1}')".so\*)
-# if [ "x${LOCAL_MATCHES}" != "x" ];
-# then
-# for llib in ${LOCAL_MATCHES};
-# do
-# pdebug " Found locally, copying ${llib}"
-# echo ${llib} >> "${COPYFILES_LIST}"
-# done
-# else
-# if [ ! -z ${arrIN[1]} ] && [ "x${arrIN[1]}" != "xnot" ];
-# then
-# pdebug " Not found locally but in system, copying ${arrIN[1]}"
-# echo ${arrIN[1]} >> "${COPYFILES_LIST}"
-# [ -L ${arrIN[1]} ] && echo $(readlink -f "${arrIN[1]}") >> "${COPYFILES_LIST}"
-# else
-# pwarning "Lib '${arrIN[0]}' from required dir '$ENTRY' neither found in build directory nor on this system."
-# pwarning "If this lib is not supplied by another module, this module will probably fail in your final system"
-# fi
-# fi
-# done
-# done
+ for BIN in $(find "./${ENTRY}" -type f -not -name '*.a' | xargs grep -l '^.ELF')
+ do
+ pdebug " Searching libs for ${BIN}..."
+ for i in $(ldd ${BIN} | awk '{print $1 $2 $3}' | grep -v ld-linux | grep -v libc.so | grep -v linux-gate | grep -v linux-vdso)
+ do
+ arrIN=(${i//=>/ })
+ pdebug " Searching for ${arrIN[0]}...($i)"
+ local LOCAL_MATCHES=$(find . -name "$(echo ${arrIN[0]} | awk -F '.' '{print $1}')".so\*)
+ if [ "x${LOCAL_MATCHES}" != "x" ];
+ then
+ for llib in ${LOCAL_MATCHES};
+ do
+ pdebug " Found locally, copying ${llib}"
+ echo ${llib} >> "${COPYFILES_LIST}"
+ done
+ else
+ if [ ! -z ${arrIN[1]} ] && [ "x${arrIN[1]}" != "xnot" ];
+ then
+ pdebug " Not found locally but in system, copying ${arrIN[1]}"
+ echo ${arrIN[1]} >> "${COPYFILES_LIST}"
+ [ -L ${arrIN[1]} ] && echo $(readlink -f "${arrIN[1]}") >> "${COPYFILES_LIST}"
+ else
+ pwarning "Lib '${arrIN[0]}' from required dir '$ENTRY' neither found in build directory nor on this system."
+ pwarning "If this lib is not supplied by another module, this module will probably fail in your final system"
+ fi
+ fi
+ done
+ done
done
[ ! -z "${REQUIRED_FILES}" ] && pinfo "Gathering required files from config file..."
@@ -167,10 +197,11 @@ generate_stage32 () {
cd ${TOOL_DIR}
while (( "$#" )); do
TOOL=$1
- TOOL_STR=""
- pinfo ">>>>>>>>>>>>>>>> Processing module [ $TOOL ]"
- TOOL_STR="[${TOOL}]"
- if [ -d ${TOOL} ]; then
+ if [ -d ${TOOL} ];
+ then
+ TOOL_STR="[${TOOL}]"
+ pinfo "## ## Processing module ## ##"
+
#[ "x$DEBUG" != "x1" ] \
# && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \
# && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log
@@ -198,13 +229,13 @@ generate_stage32 () {
#[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&-
# TODO
pinfo "## ## Module completed ## ##"
+ TOOL_STR=""
else
perror "Tool directory for '$TOOL' not found."
# maybe make this a warning instead of error?
fi
shift
done
- TOOL_STR=""
}
clean_tools() {