X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=rewrite%2Fgrml.prepare;fp=rewrite%2Fgrml.prepare;h=62e5be100ea26e3dd4c2125cfd0be02f6a7a942a;hb=5a06133348dd9abc9dbae6bb86a662dc766dd485;hp=b2d5000430e83f97fa9e15da552b04020eda65ef;hpb=ec8b1031df42f0854327649a0d7761228d3acd40;p=grml-live.git diff --git a/rewrite/grml.prepare b/rewrite/grml.prepare index b2d5000..62e5be1 100644 --- a/rewrite/grml.prepare +++ b/rewrite/grml.prepare @@ -1,10 +1,10 @@ -#!/bin/sh +#!/bin/bash # Filename: grml.clean # Purpose: clean up grml chroot # Authors: (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is copyright by Michael Prokop -# Latest change: Sun Apr 15 17:31:51 CEST 2007 +# Latest change: Sun Apr 22 14:15:03 CEST 2007 [mika] ################################################################################ # misc stuff @@ -14,8 +14,20 @@ # variables grep -q small /etc/grml_version && GRML_SMALL=yes || GRML_SMALL='' - [ -n "$GRML_SMALL" ] && KERNEL='2.6.20-grml-small' || KERNEL='2.6.20-grml' - [ -r /lib64 ] && KERNEL='2.6.20-grml64' && GRML_SMALL='' + if [ -n "$GRML_SMALL" ] ; then + echo -n 'Are you sure you want to run GRML_SMALL stuff? [y|N] ' + read a + if [ "$a" == 'y' ] ; then + echo 'Continuing as requested.' + else + echo 'Exiting as requested.' + unset GRML_SMALL + exit 1 + fi + fi + +# detect kernel version, assume newest kernel version + KERNEL=$(ls -1 /lib/modules/ | sort -r -u | head -1) if [ -f /usr/share/fonts/X11/misc/artwiz-cursor.pcf.gz ] ; then if dpkg-divert --list artwiz-cursor | grep -q /usr/share/fonts/X11/misc/cursor.pcf.gz ; then @@ -68,9 +80,13 @@ if [ -z "$GRML_SMALL" ] ; then if [ -L /usr/include/linux ] ; then einfo "/usr/include/linux is ok" ; eend 0 else - eerror "/usr/include/linux is NOT a symlink to /usr/src/linux/include/linux/ - error" - eend 1 - exit 10 + if [ -d /usr/src/linux-headers-"$KERNEL" ] ; then + eerror "/usr/include/linux is NOT a symlink to /usr/src/linux/include/linux/ - error" + eend 1 + exit 10 + else + ewarn "linux-headers-$KERNEL not installed." ; eend 0 + fi fi fi @@ -122,7 +138,6 @@ fi # find /var -name \*.pid einfo "Removing pid-files" -# find /var/run -name \*.pid | xargs rm ; echo "done" find /var/run -name \*.pid -exec rm {} \; eend $? @@ -138,25 +153,34 @@ einfo "Removing initrd-images" eend $? einfo "Removing /var/lib/apt/lists/*-stuff, dpkg-status-old and pkgcache.bin" + # for i in $(find /var/lib/apt/lists -type f \( -name \*Packages -o -name \*Sources \) 2>/dev/null); do :>"$i"; done + # for i in /var/lib/apt/lists/*_{Release,Packages,Sources}; do :>$i; touch -t 198103190000.00 $i; done + # sync-available 2>/dev/null + # apt-get check 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/*.gpg # :> /var/cache/apt/pkgcache.bin # :> /var/cache/apt/srcpkgcache.bin - rm -f /var/lib/dpkg/status-old - rm -f /var/lib/dpkg/available-old rm -f /var/cache/debconf/templates.dat-old - # for i in $(find /var/lib/apt/lists -type f \( -name \*Packages -o -name \*Sources \) 2>/dev/null); do :>"$i"; done - # for i in /var/lib/apt/lists/*_{Release,Packages,Sources}; do :>$i; touch -t 198103190000.00 $i; done - apt-get check - dpkg --clear-avail rm -f /var/cache/apt/*.bin - apt-cache gencaches - sync-available - # apt-get check + apt-get check 2>/dev/null + dpkg --clear-avail + apt-cache gencaches 2>/dev/null + rm -f /var/lib/dpkg/status-old + rm -f /var/lib/dpkg/available-old eend $? +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 && \ + cp status.new /var/lib/dpkg/status && chmod 644 /var/lib/dpkg/status && \ + chown root:root /var/lib/dpkg/status && rm status.new && eend 0 || eend 1 +else + ewarn "Warning: /usr/bin/grep-dctrl not available." +fi + einfo "Copying original runlevel.conf to /etc/runlevel.conf" if ! [ -z $GRML_SMALL ] ; then cp /etc/runlevel.conf.livecd.small /etc/runlevel.conf @@ -289,18 +313,27 @@ eend $? einfo "Setting up /etc/resolv.conf" if [ -d /etc/dhcpc ] ; then - cat >/etc/dhcpc/resolv.conf </etc/dhcpc/resolv.conf </etc/resolv.conf <