aboutsummaryrefslogtreecommitdiffstats
path: root/chapter7/cleanup.sh
blob: 93e8a88089c0000b8200d69f3fbec9148172c9cb (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
#!/bin/bash

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 >/dev/null 2>&1
	sudo find "${LFS}"/usr/libexec -name \*.la -delete >/dev/null 2>&1

	sudo rm -rf "${LFS}"/usr/share/doc >/dev/null 2>&1
	sudo rm -rf "${LFS}"/usr/share/info >/dev/null 2>&1
	sudo rm -rf "${LFS}"/usr/share/man >/dev/null 2>&1

	#find "${LFS}"/usr/lib -type f -executable -print | xargs sudo strip --strip-debug
	sudo strip --strip-debug "${LFS}"/usr/lib/* >/dev/null 2>&1 || true
	sudo strip --strip-unneeded "${LFS}"/usr/bin/* >/dev/null 2>&1 || true
	sudo strip --strip-unneeded "${LFS}"/usr/sbin/* >/dev/null 2>&1 || true
	sudo strip --strip-unneeded "${LFS}"/tools/bin/* >/dev/null 2>&1 || true

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