#!/bin/bash set -e if [ -f "${LFS}/sources/chapter7/cleanup" ]; then printf "%b" " ${IGRN}Cleanup already performed${RST}\n" else printf "%b" "${GRN}Cleaning up ${YLW}${LFS}${RST}... " { sudo find "${LFS}"/usr/lib -name \*.la -delete sudo find "${LFS}"/usr/libexec -name \*.la -delete sudo rm -rfv "${LFS}"/usr/share/doc sudo rm -rfv "${LFS}"/usr/share/info sudo rm -rfv "${LFS}"/usr/share/man sudo strip --strip-debug "${LFS}"/usr/lib/* || true sudo strip --strip-unneeded "${LFS}"/usr/bin/* || true sudo strip --strip-unneeded "${LFS}"/usr/sbin/* || true sudo strip --strip-unneeded "${LFS}"/tools/bin/* || true } >"${LFS}"/sources/log/chapter7/cleanup.log 2>&1 success "OK" sudo touch "${LFS}"/sources/chapter7/cleanup >/dev/null 2>&1 fi