aboutsummaryrefslogtreecommitdiffstats
path: root/chapter7/cleanup.sh
blob: 53ad4d40d48e73821d82ac41b70301883022f1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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

	printf "%b" "${IGRN}OK${RST}\n"
	sudo touch "${LFS}"/sources/chapter7/cleanup >/dev/null 2>&1
fi