From: Sebastian Pipping Date: Mon, 16 Apr 2012 01:18:48 +0000 (+0200) Subject: Add error detection to copy_binaries X-Git-Tag: v3.4.30~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e947f441600d0d22cdf31337514c163ac4a3a05;p=genkernel.git Add error detection to copy_binaries --- diff --git a/gen_initramfs.sh b/gen_initramfs.sh index f3c14c2..61ebce1 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -6,13 +6,23 @@ CPIO_ARGS="--quiet -o -H newc" copy_binaries() { local destdir=$1 shift - lddtree "$@" \ - | tr ')(' '\n' \ - | awk '/=>/{ if($3 ~ /^\//){print $3}}' \ - | sort \ - | uniq \ - | cpio -p --make-directories --dereference --quiet $destdir + for binary in "$@"; do + [[ -e "${binary}" ]] \ + || gen_die "Binary ${binary} could not be found" + + if LC_ALL=C lddtree "${binary}" 2>&1 | fgrep -q 'not found'; then + gen_die "Binary ${binary} is linked to missing libraries and may need to be re-built" + fi + + lddtree "${binary}" \ + | tr ')(' '\n' \ + | awk '/=>/{ if($3 ~ /^\//){print $3}}' \ + | sort \ + | uniq \ + | cpio -p --make-directories --dereference --quiet "${destdir}" \ + || gen_die "Binary ${f} or some of its library dependencies could not be copied" + done } append_base_layout() {