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 # check for policy-rc.d workaround of
12 # /etc/grml/fai/config/hooks/updatebase.GRMLBASE
13 if [ -r $target/usr/sbin/policy-rc.d ] ; then
14 if grep -q 'FAI_ACTION=updatebase' $target/usr/sbin/policy-rc.d ; then
15 rm -f $target/usr/sbin/policy-rc.d
19 # remove some big directories when using class LATEX_CLEANUP:
20 if ifclass LATEX_CLEANUP ; then
21 cp /etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup $target/root/
22 $ROOTCMD /root/grml_cleanup_chroot.latex_cleanup
23 rm $target/root/grml_cleanup_chroot.latex_cleanup
26 # skip tasks which require only when using class NO_ONLINE:
27 if ! ifclass NO_ONLINE ; then
28 cp /etc/grml/fai/grml/grml_cleanup_chroot.online $target/root/
29 $ROOTCMD /root/grml_cleanup_chroot.online
30 rm $target/root/grml_cleanup_chroot.online
33 # make sure to drop from grml-small what's unnecessary:
34 if ifclass GRML_SMALL ; then
35 $ROOTCMD apt-get -y --purge remove aptitude
36 for pkg in groff-base info locales man-db manpages nano; do
37 $ROOTCMD apt-get --purge remove --yes $pkg || true
41 # drop unnecessary software:
42 if ifclass GRML_SMALL || ifclass DEBORPHAN ; then
43 if [ -f /etc/grml/fai/grml/grml_cleanup_chroot.deborphan ] ; then
44 cp /etc/grml/fai/grml/grml_cleanup_chroot.deborphan $target/root/
45 $ROOTCMD /root/grml_cleanup_chroot.deborphan
46 rm $target/root/grml_cleanup_chroot.deborphan
50 # remove /usr/share/doc, /usr/share/info,... only in class REMOVE_DOCS:
51 # (important: remove them *after* deinstalling packages, otherwise
52 # removing packages might fail due to lack of /usr/share/man/...)
53 if ifclass REMOVE_DOCS ; then
54 cp /etc/grml/fai/grml/grml_cleanup_chroot.remove_docs $target/root/
55 $ROOTCMD /root/grml_cleanup_chroot.remove_docs
56 rm $target/root/grml_cleanup_chroot.remove_docs
59 if [ -f /etc/grml/fai/grml/grml_cleanup_chroot ] ; then
60 cp /etc/grml/fai/grml/grml_cleanup_chroot $target/root/
61 $ROOTCMD /root/grml_cleanup_chroot
62 rm $target/root/grml_cleanup_chroot
65 # make sure GRML_SMALL uses the appropriate configuration:
66 if ifclass GRML_SMALL ; then
67 cp $target/etc/inittab.small $target/etc/inittab
70 if ifclass RELEASE ; then
71 # Remove all FAI logs from chroot via grml-live later then:
72 touch $target/etc/grml_fai_release
73 # Remove all files inside /root/ of chroot:
74 rm -rf $target/root && mkdir -m 0755 $target/root
77 ## END OF FILE #################################################################
78 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3