#!/bin/sh -x

echo "I: Remove unneeded files from /usr/share/doc "
find binary/boot/filesystem.dir/usr/share/doc -depth -type f ! -name copyright|xargs rm -f || true
find binary/boot/filesystem.dir/usr/share/doc -empty|xargs rmdir || true
find binary/boot/filesystem.dir/usr/share/doc -type f -exec gzip -9 {} \;

echo "I: Remove man/info pages"
rm -rf binary/boot/filesystem.dir/usr/share/man \
       binary/boot/filesystem.dir/usr/share/groff \
       binary/boot/filesystem.dir/usr/share/info \
       binary/boot/filesystem.dir/usr/share/lintian \
       binary/boot/filesystem.dir/usr/share/linda \
       binary/boot/filesystem.dir/var/cache/man
    

echo "I: Removing /var/lib/apt/lists/*"
find binary/boot/filesystem.dir/var/lib/apt/lists/ -type f | xargs rm -f

echo "I: Removing /var/cache/apt/*.bin"
rm -f binary/boot/filesystem.dir/var/cache/apt/*.bin