1#!/bin/bash -u 2# 3# This is one of the scripts that is passed to binary_search_state.py to do 4# the bisection. This one takes a list of object files (either a real list or 5# a file containing the list) and copies the files from the good objects 6# directory to the working directory. 7# 8 9 10source full_bisect_test/common.sh 11 12pushd ${BISECT_WORK_BUILD} 13chmod 644 * 14 15OBJ_LIST_FILES=$1 16FILE_ARGS=0 17 18if [[ -f ${OBJ_LIST_FILES} ]] ; then 19 file ${OBJ_LIST_FILES} &> ${BISECT_WORK_BUILD}/file_type.tmp 20 grep "ASCII text" ${BISECT_WORK_BUILD}/file_type.tmp 21 result=$? 22 if [[ ${result} -eq 0 ]] ; then 23 FILE_ARGS=1 24 fi 25 rm ${BISECT_WORK_BUILD}/file_type.tmp 26fi 27 28overall_status=0 29 30if [[ ${FILE_ARGS} -eq 1 ]] ; then 31 while read obj || [[ -n "${obj}" ]]; 32 do 33 echo "Copying {BISECT_GOOD_BUILD}/${obj} to ${BISECT_WORK_BUILD}" 34 cp ${BISECT_GOOD_BUILD}/${obj} ${BISECT_WORK_BUILD} 35# cp ${obj} ${BISECT_WORK_BUILD}/. 36 status=$? 37 if [[ ${status} -ne 0 ]] ; then 38 echo "Failed to copy ${obj} to work build tree." 39 overall_status=2 40 fi 41 done < ${OBJ_LIST_FILES} 42else 43 44 for o in "$@" 45 do 46 cp ${BISECT_GOOD_BUILD}/${o} ${BISECT_WORK_BUILD} 47 status=$? 48 if [[ ${status} -ne 0 ]] ; then 49 echo "Failed to copy ${o} to work build tree." 50 overall_status=2 51 fi 52 done 53fi 54 55popd 56 57exit ${overall_status} 58