diff options
Diffstat (limited to 'pack-debuginfo.sh')
-rwxr-xr-x | pack-debuginfo.sh | 43 |
1 files changed, 19 insertions, 24 deletions
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 |