diff options
author | William Harrington <kb0iic@berzerkula.org> | 2021-12-11 00:52:08 -0600 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2021-12-11 00:52:08 -0600 |
commit | 2c8204d6325a1a6607392d5905227b9043da17cc (patch) | |
tree | 5a2d9047d0a3fb5664c17284b92c6e572507d062 /chapter8/cleanup.sh | |
parent | f699702e72de8200632cfb95350ad51bb68c4b6f (diff) |
Major updates.
Diffstat (limited to 'chapter8/cleanup.sh')
-rw-r--r-- | chapter8/cleanup.sh | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/chapter8/cleanup.sh b/chapter8/cleanup.sh index 12bbae4..eb35b67 100644 --- a/chapter8/cleanup.sh +++ b/chapter8/cleanup.sh @@ -1,68 +1,68 @@ -#!/bin/bash -set -e - -if [ -f "${LFS}/sources/chapter8/cleanup" ]; then - printf "%b" " ${IGRN}Cleanup already performed${RST}\n" -else - - printf "%b" "${GRN}Cleaning up ${YLW}${LFS}${RST}... " - - { - - sudo rm -rfv "${LFS}"/tmp/* - sudo rm -rfv "${LFS}"/tools - - sudo find "${LFS}"/usr/lib -name \*.la -delete - sudo find "${LFS}"/usr/libexec -name \*.la -delete - - sudo find "${LFS}"/usr -depth -name "$(uname -m)"-lfs-linux-gnu\* | xargs sudo rm -rfv - - sudo sed '/tester/d' -i "${LFS}"/etc/group - sudo sed '/tester/d' -i "${LFS}"/etc/passwd - sudo rm -rfv "${LFS}"/home/tester - - #sudo rm -rfv "${LFS}"/usr/share/doc - #sudo rm -rfv "${LFS}"/usr/share/info - #sudo rm -rfv "${LFS}"/usr/share/man - - # Place debugging symbols for selected libraries in seprate files - save_lib="ld-2.33.so libc-2.33.so libpthread-2.33.so libthread_db-1.0.so" - pushd "${LFS}"/lib || exit 1 - - for LIB in $save_lib; do - sudo objcopy --only-keep-debug "${LIB}" "${LIB}".dbg - sudo strip --strip-unneeded "${LIB}" - sudo objcopy --add-gnu-debuglink="${LIB}".dbg "${LIB}" - done - - popd || exit 1 - - save_usrlib="libquadmath.so.0.0.0 libstdc++.so.6.0.28 libitm.so.1.0.0 libatomic.so.1.2.0" - - pushd "${LFS}"/usr/lib || exit 1 - - for LIB in $save_usrlib; do - sudo objcopy --only-keep-debug "${LIB}" "${LIB}".dbg - sudo strip --strip-unneeded "${LIB}" - sudo objcopy --add-gnu-debuglink="${LIB}".dbg "${LIB}" - done - - popd || exit 1 - - sudo find "${LFS}"/usr/lib -type f -name \*.a -exec strip --strip-debug {} ';' - sudo find "${LFS}"/lib -type f -name \*.so* ! -name \*dbg -exec strip --strip-unneeded {} ';' - sudo find "${LFS}"/usr/lib -type f -name \*.so* ! -name \*dbg -exec strip --strip-unneeded {} ';' - - - sudo find "${LFS}"/bin -type f -exec strip --strip-all {} ';' - sudo find "${LFS}"/sbin -type f -exec strip --strip-all {} ';' - sudo find "${LFS}"/usr/bin -type f -exec strip --strip-all {} ';' - sudo find "${LFS}"/usr/sbin -type f -exec strip --strip-all {} ';' - sudo find "${LFS}"/usr/libexec -type f -exec strip --strip-all {} ';' - - -} >"${LFS}"/sources/log/chapter8/cleanup.log 2>&1 - - success "OK" - sudo touch "${LFS}"/sources/chapter8/cleanup >/dev/null 2>&1 -fi +#!/bin/bash
+set -e
+
+if [ -f "${LFS}/sources/chapter8/cleanup" ]; then
+ printf "%b" " ${IGRN}Cleanup already performed${RST}\n"
+else
+
+ printf "%b" "${GRN}Cleaning up ${YLW}${LFS}${RST}... "
+
+ {
+
+ sudo rm -rfv "${LFS}"/tmp/*
+ sudo rm -rfv "${LFS}"/tools
+
+ sudo find "${LFS}"/usr/lib -name \*.la -delete
+ sudo find "${LFS}"/usr/libexec -name \*.la -delete
+
+ sudo find "${LFS}"/usr -depth -name "$(uname -m)"-lfs-linux-gnu\* | xargs sudo rm -rfv
+
+ sudo sed '/tester/d' -i "${LFS}"/etc/group
+ sudo sed '/tester/d' -i "${LFS}"/etc/passwd
+ sudo rm -rfv "${LFS}"/home/tester
+
+ #sudo rm -rfv "${LFS}"/usr/share/doc
+ #sudo rm -rfv "${LFS}"/usr/share/info
+ #sudo rm -rfv "${LFS}"/usr/share/man
+
+ # Place debugging symbols for selected libraries in seprate files
+ save_lib="ld-2.33.so libc-2.33.so libpthread-2.33.so libthread_db-1.0.so"
+ pushd "${LFS}"/lib || exit 1
+
+ for LIB in $save_lib; do
+ sudo objcopy --only-keep-debug "${LIB}" "${LIB}".dbg
+ sudo strip --strip-unneeded "${LIB}"
+ sudo objcopy --add-gnu-debuglink="${LIB}".dbg "${LIB}"
+ done
+
+ popd || exit 1
+
+ save_usrlib="libquadmath.so.0.0.0 libstdc++.so.6.0.28 libitm.so.1.0.0 libatomic.so.1.2.0"
+
+ pushd "${LFS}"/usr/lib || exit 1
+
+ for LIB in $save_usrlib; do
+ sudo objcopy --only-keep-debug "${LIB}" "${LIB}".dbg
+ sudo strip --strip-unneeded "${LIB}"
+ sudo objcopy --add-gnu-debuglink="${LIB}".dbg "${LIB}"
+ done
+
+ popd || exit 1
+
+ sudo find "${LFS}"/usr/lib -type f -name \*.a -exec strip --strip-debug {} ';'
+ sudo find "${LFS}"/lib -type f -name \*.so* ! -name \*dbg -exec strip --strip-unneeded {} ';'
+ sudo find "${LFS}"/usr/lib -type f -name \*.so* ! -name \*dbg -exec strip --strip-unneeded {} ';'
+
+
+ sudo find "${LFS}"/bin -type f -exec strip --strip-all {} ';'
+ sudo find "${LFS}"/sbin -type f -exec strip --strip-all {} ';'
+ sudo find "${LFS}"/usr/bin -type f -exec strip --strip-all {} ';'
+ sudo find "${LFS}"/usr/sbin -type f -exec strip --strip-all {} ';'
+ sudo find "${LFS}"/usr/libexec -type f -exec strip --strip-all {} ';'
+
+
+} >"${LFS}"/sources/log/chapter8/cleanup.log 2>&1
+
+ success "OK"
+ sudo touch "${LFS}"/sources/chapter8/cleanup >/dev/null 2>&1
+fi
|