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 # Latest change: Thu Sep 18 01:32:11 CEST 2008 [mika]
8 ################################################################################
12 # remove some big directories when using class LATEX_CLEANUP:
13 if ifclass LATEX_CLEANUP ; then
14 cp /etc/grml/fai/grml/grml_cleanup_chroot.latex_cleanup $target/root/
15 $ROOTCMD /root/grml_cleanup_chroot.latex_cleanup
16 rm $target/root/grml_cleanup_chroot.latex_cleanup
19 # skip tasks which require only when using class NO_ONLINE:
20 if ! ifclass NO_ONLINE ; then
21 cp /etc/grml/fai/grml/grml_cleanup_chroot.online $target/root/
22 $ROOTCMD /root/grml_cleanup_chroot.online
23 rm $target/root/grml_cleanup_chroot.online
26 # make sure to drop from grml-small what's unnecessary:
27 if ifclass GRML_SMALL ; then
28 $ROOTCMD apt-get -y --purge remove aptitude
29 for pkg in groff-base info locales man-db manpages nano; do
30 $ROOTCMD apt-get --purge remove --yes $pkg || true
34 # drop unnecessary software:
35 if ifclass GRML_SMALL || ifclass DEBORPHAN ; then
36 if [ -f /etc/grml/fai/grml/grml_cleanup_chroot.deborphan ] ; then
37 cp /etc/grml/fai/grml/grml_cleanup_chroot.deborphan $target/root/
38 $ROOTCMD /root/grml_cleanup_chroot.deborphan
39 rm $target/root/grml_cleanup_chroot.deborphan
43 # remove /usr/share/doc, /usr/share/info,... only in class REMOVE_DOCS:
44 # (important: remove them *after* deinstalling packages, otherwise
45 # removing packages might fail due to lack of /usr/share/man/...)
46 if ifclass REMOVE_DOCS ; then
47 cp /etc/grml/fai/grml/grml_cleanup_chroot.remove_docs $target/root/
48 $ROOTCMD /root/grml_cleanup_chroot.remove_docs
49 rm $target/root/grml_cleanup_chroot.remove_docs
52 if [ -f /etc/grml/fai/grml/grml_cleanup_chroot ] ; then
53 cp /etc/grml/fai/grml/grml_cleanup_chroot $target/root/
54 $ROOTCMD /root/grml_cleanup_chroot
55 rm $target/root/grml_cleanup_chroot
58 # make sure GRML_SMALL uses the appropriate configuration:
59 if ifclass GRML_SMALL ; then
60 cp $target/etc/inittab.small $target/etc/inittab
61 cp $target/etc/runlevel.conf.livecd.small $target/etc/runlevel.conf
64 if ifclass RELEASE ; then
65 # Remove all FAI logs from chroot via grml-live later then:
66 touch $target/etc/grml_fai_release
67 # Remove all files inside /root/ of chroot:
68 rm -rf $target/root && mkdir -m 0755 $target/root
71 ## END OF FILE #################################################################
72 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3