2 # Filename: /etc/grml/fai/config/scripts/GRMLBASE/98-clean-chroot
3 # Purpose: clean up chroot system
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
11 # remove some big directories when using class LATEX_CLEANUP:
12 if ifclass LATEX_CLEANUP ; then
13 cp /etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup $target/root/
14 $ROOTCMD /root/grml_cleanup_chroot.latex_cleanup
15 rm $target/root/grml_cleanup_chroot.latex_cleanup
18 # skip tasks which require only when using class NO_ONLINE:
19 if ! ifclass NO_ONLINE ; then
20 cp /etc/grml/fai/grml/grml_cleanup_chroot.online $target/root/
21 $ROOTCMD /root/grml_cleanup_chroot.online
22 rm $target/root/grml_cleanup_chroot.online
25 # make sure to drop from grml-small what's unnecessary:
26 if ifclass GRML_SMALL ; then
27 $ROOTCMD apt-get -y --purge remove aptitude
28 for pkg in groff-base info locales man-db manpages nano; do
29 $ROOTCMD apt-get --purge remove --yes $pkg || true
33 # drop unnecessary software:
34 if ifclass GRML_SMALL || ifclass DEBORPHAN ; then
35 if [ -f /etc/grml/fai/grml/grml_cleanup_chroot.deborphan ] ; then
36 cp /etc/grml/fai/grml/grml_cleanup_chroot.deborphan $target/root/
37 $ROOTCMD /root/grml_cleanup_chroot.deborphan
38 rm $target/root/grml_cleanup_chroot.deborphan
42 # remove /usr/share/doc, /usr/share/info,... only in class REMOVE_DOCS:
43 # (important: remove them *after* deinstalling packages, otherwise
44 # removing packages might fail due to lack of /usr/share/man/...)
45 if ifclass REMOVE_DOCS ; then
46 cp /etc/grml/fai/grml/grml_cleanup_chroot.remove_docs $target/root/
47 $ROOTCMD /root/grml_cleanup_chroot.remove_docs
48 rm $target/root/grml_cleanup_chroot.remove_docs
51 if [ -f /etc/grml/fai/grml/grml_cleanup_chroot ] ; then
52 cp /etc/grml/fai/grml/grml_cleanup_chroot $target/root/
53 $ROOTCMD /root/grml_cleanup_chroot
54 rm $target/root/grml_cleanup_chroot
57 # make sure GRML_SMALL uses the appropriate configuration:
58 if ifclass GRML_SMALL ; then
59 cp $target/etc/inittab.small $target/etc/inittab
62 if ifclass RELEASE ; then
63 # Remove all FAI logs from chroot via grml-live later then:
64 touch $target/etc/grml_fai_release
65 # Remove all files inside /root/ of chroot:
66 rm -rf $target/root && mkdir -m 0755 $target/root
69 ## END OF FILE #################################################################
70 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3