X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=etc%2Fgrml%2Ffai%2Fgrml%2Fgrml_cleanup_chroot;h=e58bbfaf1ed6e441d86e2777856b3f4d293e495c;hp=4b6df6da9085b28a85aa93b043e30d0f51d3bef1;hb=3e5fb2360b0df8563ade7c0ec43acf655698fc13;hpb=9432d0c8bb27f92846c42f864bc566da32d172f1 diff --git a/etc/grml/fai/grml/grml_cleanup_chroot b/etc/grml/fai/grml/grml_cleanup_chroot index 4b6df6d..e58bbfa 100755 --- a/etc/grml/fai/grml/grml_cleanup_chroot +++ b/etc/grml/fai/grml/grml_cleanup_chroot @@ -4,7 +4,6 @@ # Authors: (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sun Nov 04 12:12:57 CET 2007 [mika] ################################################################################ # misc stuff @@ -74,22 +73,6 @@ if [ -x /usr/bin/make -a -r /usr/src/Makefile ] ; then eend $? fi -if [ -L /usr/include/linux ] ; then - einfo "/usr/include/linux is ok" ; eend 0 -elif [ -n "$GRML64" ] ; then - if [ -d /usr/src/linux-headers-"$KERNEL" ] ; then - einfo "grml64 detected, assuming /usr/src/linux-headers-$KERNEL is ok." ; eend 0 - else - ewarn "Warning: /usr/src/linux-headers-$KERNEL not found, exiting." ; eend 0 - fi -elif [ -d /usr/src/linux-headers-"$KERNEL" ] ; then - ewarn "Warning: /usr/include/linux is NOT a symlink to /usr/src/linux/include/linux/ (possible an error)" - ewarn "Common reason: you forgot to install linux-kernel-headers-grml and use linux-libc-dev instead" - eend 0 -else - ewarn "Warning: linux-headers-$KERNEL not installed." ; eend 0 -fi - einfo "Creating ~/.zshrc" touch ~/.zshrc eend $? @@ -129,17 +112,11 @@ einfo "Removing pid-files" find /var/run -name \*.pid -exec rm {} \; eend $? -einfo "Unmounting proc, /dev/pts, /dev/capi" - umount /proc 2>/dev/null - umount /dev/pts 2>/dev/null - umount /dev/capi 2>/dev/null - umount -a 2>/dev/null -eend $? - einfo "Removing /var/lib/apt/lists/*-stuff, dpkg-status-old and pkgcache.bin" rm -f /var/lib/apt/lists/*Packages rm -f /var/lib/apt/lists/*Release rm -f /var/lib/apt/lists/*Sources + rm -f /var/lib/apt/lists/*IndexDiff rm -f /var/lib/apt/lists/*.gpg rm -f /var/cache/apt-show-versions/* rm -f /var/cache/debconf/templates.dat-old @@ -151,6 +128,31 @@ einfo "Removing /var/lib/apt/lists/*-stuff, dpkg-status-old and pkgcache.bin" rm -f /var/lib/dpkg/available-old eend $? +if ifclass GRML_SMALL ; then + einfo "Removing /var/cache/debconf/templates.dat" + rm -f /var/cache/debconf/templates.dat + eend $? + + einfo "Removing /usr/share/ssh/blacklist.*" + rm -f /usr/share/ssh/blacklist.DSA-1024 /usr/share/ssh/blacklist.RSA-2048 + eend $? +fi + +# get rid of large kernel modules: +if ifclass GRML_SMALL ; then + einfo "Identified grml-small, removing some very large kernel drivers:" + if [ -r "/lib/modules/${KERNEL}/kernel/fs/ocfs2/ocfs2.ko" ] ; then + einfo "Removing /lib/modules/${KERNEL}/kernel/fs/ocfs2/ocfs2.ko" + rm -f "/lib/modules/${KERNEL}/kernel/fs/ocfs2/ocfs2.ko" + eend $? + fi + if [ -d "/lib/modules/${KERNEL}/kernel/drivers/isdn/hisax/" ] ; then + einfo "Removing /lib/modules/${KERNEL}/kernel/drivers/isdn/hisax" + rm -rf "/lib/modules/${KERNEL}/kernel/drivers/isdn/hisax" + eend $? + fi +fi + if [ -x /usr/bin/grep-dctrl ] ; then einfo "Cleaning up /var/lib/dpkg/status" grep-dctrl -v -F Status "purge ok not-installed" /var/lib/dpkg/status > status.new && \ @@ -160,19 +162,19 @@ else ewarn "Warning: /usr/bin/grep-dctrl not available." fi -einfo "Copying original runlevel.conf to /etc/runlevel.conf" -cp /etc/runlevel.conf.livecd /etc/runlevel.conf -eend $? - einfo "Removing x-server-conffiles" rm -f /etc/X11/xorg.conf /etc/X11/XF86Config-4 \ - /etc/X11/XF86Config /etc/XF86Config /etc/XF86Config-4 + /etc/X11/XF86Config /etc/XF86Config /etc/XF86Config-4 eend $? einfo "Removing ssh-keys" rm -f /etc/ssh/*key* eend $? +einfo "Removing unused/backup files" + find / -name *~ -print0 | xargs -0 rm -f +eend $? + # remove only "temporary" or saved files in the given directories nuke(){ for i in `find "$@" -name \*.gz -o -name \*.bz2 -o -name \*.0 2>/dev/null`; do @@ -233,7 +235,7 @@ einfo "Cleaning and removing some misc files and directories" /var/state/*/* /var/state/* /var/log/nessus/* \ /halt /reboot /ash.static /etc/dhcpc/*.info /etc/dhcpc/resolv* \ /etc/*passwd- /etc/*shadow- /etc/*group- /var/spool/postfix/maildrop/* \ - /etc/lvm/.cache 2>/dev/null + /etc/lvm/.cache /etc/lvm/cache/.cache /etc/lvm/backup/main 2>/dev/null rm -rf /tmp/* /var/tmp/* /var/tmp/.* /var/backups/* /.ssh /root/.ssh /home/*/.ssh \ /home/grml/* /home/grml/.??* /var/lib/texmf/ls-R /var/spool/texmf/ls-R \ /var/lib/mysql /var/log/lilo_log.* /core* 2>/dev/null @@ -323,25 +325,19 @@ fi if [ -x /usr/bin/updatedb ] ; then einfo "Updating locate-database" - mount -t proc none /proc updatedb --prunepaths='/tmp /usr/tmp /var/tmp /grml /root /proc /sys' - umount /proc eend $? else ewarn "updatedb not installed" ; eend 0 fi -einfo "Unmounting all filesystems" - umount -a -eend $? - ################################################################################ # MISC STUFF # ~~~~~~~~~~ # list dangling symlinks: ls **/*(-@) # # Security-audit: -# find / \! -type l -perm -2000 -ls > audit/sgid-files +# find / \! -type l -perm -2000 -ls > audit/sgid-files # find / \! -type l -perm -0002 -ls > audit/world-writeable-files # find / \! -type l -perm -4000 -ls > audit/suid-files # find / ( -perm 4000 -o -perm -2000 \) -exec ls -ld {} \; @@ -355,10 +351,7 @@ eend $? # file /usr/sbin/* | grep -v ', stripped' | grep -v 'perl' | grep -v 'Bourne' | grep -v 'python' | grep -v 'symbolic link' # # Is software by grml-repos up2date? -# grep-dctrl --field Maintainer 'Michael Prokop' /var/lib/apt/lists/grml.org_repos_._* | grep Package | awk '{print $2}' | xargs echo -# -# runlevel.conf: -# for file in /etc/init.d/* ; do grep $file -q /etc/runlevel.conf.hdinstall || echo $file not found ; done +# grep-dctrl --field Maintainer 'Michael Prokop' /var/lib/apt/lists/* | grep Package | awk '{print $2}' | xargs echo ################################################################################ ## END OF FILE #################################################################