From 5a06133348dd9abc9dbae6bb86a662dc766dd485 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 9 May 2007 19:40:22 +0200 Subject: [PATCH] Closes #issue209, check for ntfs.ko before loading it --- rewrite/grml.prepare | 95 +++++++++++++++++++++++++++++++++++----------------- rewrite/linuxrc | 12 +++---- 2 files changed, 70 insertions(+), 37 deletions(-) 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 <, (c) Michael Prokop -# Latest change: Sat Apr 14 12:41:44 CEST 2007 [mika] +# Latest change: Wed May 09 19:38:42 CEST 2007 [mika] ####################################################################################### # hardcoded configurable options @@ -134,7 +134,7 @@ if checkbootparam "splash" ; then echo "${RED} | |_| | _ <| | | | |___ " echo "${RED} \____|_| \_\_| |_|_____|" echo "" - echo "${WHITE}grml.org - Linux for users of texttools and sysadmins." + echo "${WHITE}grml.org - Linux for sysadmins and texttool users." echo "${NORMAL}" exec >/dev/null &1 fi @@ -187,7 +187,7 @@ ${RED} | | _| |_) | |\/| | | ${RED} | |_| | _ <| | | | |___ ${RED} \____|_| \_\_| |_|_____| -${WHITE}grml.org - Linux for users of texttools and sysadmins. +${WHITE}grml.org - Linux for sysadmins and texttool users. ${NORMAL}" fi @@ -459,7 +459,7 @@ fi # Unfortunately, hotpluggable devices tend to need some time in order to register if test -n "$FOUNDUSB" -o -n "$FOUNDFIREWIRE"; then log_begin_msg "Scanning for USB/Firewire devices." - sleep 4 + sleep 6 if test -n "$USB"; then sleep 10 fi @@ -666,7 +666,7 @@ boot_from() # load filesystems /GRML/sbin/modprobe fuse /GRML/sbin/modprobe ntfs - $INSMOD /modules/div/ntfs.ko 1>/dev/null + [ -r /modules/div/ntfs.ko ] && $INSMOD /modules/div/ntfs.ko 1>/dev/null if [ -n "$ISO_PATH" ]; then LOOP_SOURCE="$TARGET.loop" @@ -686,7 +686,7 @@ boot_from() return 1 fi - if [ -f $TARGET/$GRML_DIR/$GRML_NAME ]; then + if [ -f "$TARGET/$GRML_DIR/$GRML_NAME" ]; then log_begin_msg "Accessing grml CD-ROM at ${MAGENTA}$TARGET_DEV${NORMAL}." ; echo " $SUCCESS" else log_failure_msg "Accessing grml CD-ROM failed. Could not find $GRML_DIR/$GRML_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}" ; echo "$FAILED" -- 2.1.4