Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # vim: set et sw=4 sts=4 :
- if [ x$INSTALL_SOURCES = x ]
- then
- exit 0
- fi
- echo "Running installsources"
- touch /tmp/installsources
- save_elf_sources() {
- local binary=$1
- local sources_dir=/usr/src/debug/${CATEGORY}/${PF}
- debugedit -b "${WORKDIR}" -d "${sources_dir}" \
- -l "${T}"/debug.sources "${binary}"
- if [[ -s ${T}/debug.sources ]] ; then
- [[ -d ${D}${sources_dir} ]] || mkdir -p "${D}${sources_dir}"
- grep -zv '/<built-in>$' "${T}"/debug.sources | \
- (cd "${WORKDIR}"; LANG=C sort -z -u | \
- rsync -rtL0 --files-from=- "${WORKDIR}/" "${D}${sources_dir}/" 2>/dev/null )
- fi
- }
- for binary in \
- $(scanelf -yqRBF '#k%F' -k '.symtab' "${D}")
- do
- ftype=$(file "${binary}") || continue
- [[ -z ${ftype} ]] && continue
- if [[ ${ftype} == *"SB executable"*
- || ${ftype} == *"SB shared object"*
- || ${ftype} == *"SB relocatable"* ]] ;
- then
- echo " ${binary:${#D}}"
- save_elf_sources "${binary}"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement