diff options
-rwxr-xr-x | extract-distro.sh | 14 | ||||
-rwxr-xr-x | extract-rpm.sh | 2 | ||||
-rwxr-xr-x | pack-debuginfo.sh | 43 |
3 files changed, 27 insertions, 32 deletions
diff --git a/extract-distro.sh b/extract-distro.sh index 866b897..ef8f452 100755 --- a/extract-distro.sh +++ b/extract-distro.sh @@ -1,17 +1,17 @@ #!/bin/sh -n=1 -if [ "x$1" = "x-j" ]; then - n=$2 - shift - shift -esac +srcdir=`dirname $0` +srcdir=`(cd "$srcdir"; pwd)` +PATH="$srcdir:$PATH" here=`pwd` +df -h . for distro; do for dir in $distro/*/debug/; do echo "considering ${dir}..." - (cd "$dir" && ls | ./extract-rpm.sh "$here") | ./pack-debuginfo.sh $n + (cd "$dir" && ls | extract-rpm.sh "$here") | pack-debuginfo.sh & done + wait + df -h . done diff --git a/extract-rpm.sh b/extract-rpm.sh index 56bf0d9..1449660 100755 --- a/extract-rpm.sh +++ b/extract-rpm.sh @@ -8,7 +8,7 @@ fi dest=$1; shift -for rpm; do +while read rpm; do name="${rpm%.rpm}" if [ "$name" = "$rpm" ]; then diff --git a/pack-debuginfo.sh b/pack-debuginfo.sh index fae5cb7..de76bdd 100755 --- a/pack-debuginfo.sh +++ b/pack-debuginfo.sh @@ -7,7 +7,7 @@ get_size() do_src() { - if was=`du -sh usr/src`; then + if was=`du -sh usr/src 2> /dev/null`; then tar cf - usr/src | bzip2 -9 > src.tar.bz2 is=`du -sh src.tar.bz2` rm -rf usr/src & @@ -24,7 +24,7 @@ do_collect() > dyn > rel > archive - find usr/lib* -type f -print0 | xargs -0 file -N -F ' ' -i | + find usr/lib* -type f -print0 | xargs --no-run-if-empty -0 file -N -F ' ' -i | awk -v dir="$dir" -v src="$size" ' BEGIN { e = d = r = u = a = 0 } NF == 2 && $2 == "application/x-executable" { print $1 > "exec" ; ++e; next } @@ -46,27 +46,30 @@ do_dir() do_src & - find usr/lib/* -type f ! -links 1 -exec rm -f {} \; + find usr/lib/debug -type f ! -links 1 -exec rm -f {} \; 2> /dev/null - summary=`do_collect` - - was=`du -sh usr/lib/debug` - (echo 'all: \' - sed 's,$,.bz2,;$!s,$,\\,' exec dyn rel - echo '%.bz2: %; bzip2 -9 $<' - ) | make -s -r -f - -j`getconf _NPROCESSORS_ONLN` - is=`du -sh usr/lib/debug` - get_size $was $is + if was=`du -sh usr/lib/debug 2> /dev/null`; then + summary=`do_collect` + (echo 'all: \' + sed 's,$,.bz2,;$!s,$,\\,' exec dyn rel + echo '%.bz2: %; bzip2 -9 $<' + ) | make -s -r -f - -j`getconf _NPROCESSORS_ONLN` + is=`du -sh usr/lib/debug` + get_size $was $is + summary="$summary bz2 $size" + else + summary="debug missing" + fi wait - echo " $summary bz2 $size" >> summary + echo " $summary" >> summary cd .. + + echo "packed $dir" } -n=${1:-1} -run=$n while read dir; do if [ -r "$dir/summary" ]; then @@ -74,15 +77,7 @@ while read dir; do continue fi - - if [ $run -gt 1 ]; then - do_dir & - run=$[$run - 1] - else - do_dir - wait - run=$n - fi + do_dir done |