From: Jose V Beneyto Date: Thu, 5 Jul 2012 07:50:00 +0000 (+0000) Subject: Cleanup for 'init' script X-Git-Url: http://gitweb/?a=commitdiff_plain;h=refs%2Fheads%2F2.8;p=initramfs.git Cleanup for 'init' script --- diff --git a/init b/init index 6708906..4f04010 100755 --- a/init +++ b/init @@ -37,7 +37,7 @@ find_and_mount_media() { echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..." mkdir -p /.tmpfs/.media CRUXMEDIA="" - CDROM_DEVICES="`grep 'drive name:' /proc/sys/dev/cdrom/info | awk '{print $3 }'`" + CDROM_DEVICES="`grep 'drive name:' /proc/sys/dev/cdrom/info | awk '{ print $3 }'`" MMC_DEVICES="`grep -E 'mmcblk' /proc/partitions | awk '{ print $4 }'`" BLOCK_DEVICES="`grep -E '[sh]d' /proc/partitions | awk '{ print $4 }'`" for DEV in $CDROM_DEVICES $MMC_DEVICES $BLOCK_DEVICES @@ -51,7 +51,6 @@ find_and_mount_media() { then echo ", CRUX media." CRUXMEDIA=$DEV - #ln -s $DEV /dev/media break else echo ", but it's not the CRUX media." @@ -65,7 +64,6 @@ find_and_mount_media() { # check if the media was mounted properly. if not, spawn a shell if [ ! -e /.tmpfs/.media/crux-media ] then - echo echo -e " ${BOLD}${RED}*${NORM} The CRUX media was not properly mounted!" echo " Spawning a shell for you to attempt to fix this problem. If" echo " you are able to find the correct device, mount it at" @@ -79,7 +77,6 @@ find_and_mount_media() { # check again and stop if it's still not there if [ ! -e /.tmpfs/.media/crux-media ] then - echo echo -e " ${BOLD}${RED}*${NORM} The CRUX media still appears not to be" echo " found and installation will not continue." echo @@ -96,7 +93,7 @@ find_and_mount_media() { tar -xpf /.tmpfs/.media/rootfs.tar.xz -C /newroot checkReturn echo -e -n " ${BOLD}${BLUE}*${NORM} Copying devices from rootfs... " - cp -af /dev/* /newroot/dev + cp -af /dev/* /newroot/dev/ checkReturn mkdir -p /newroot/dev/pts /newroot/media @@ -113,9 +110,7 @@ find_and_mount_media() { /bin/busybox --install -s /bin -# # main script -# echo "" echo -e "${BOLD}CRUX-ARM 2.7.1 - ${BLUE}http://crux-arm.nu/${NORM}" @@ -136,8 +131,7 @@ mount -t sysfs sysfs /sys echo -e -n " ${BOLD}${BLUE}*${NORM} Populating /dev via mdev... " mdev -s checkReturn - -echo -e -n " ${BOLD}${BLUE}*${NORM} Registering mdev as hotplug agent... " +echo -e -n " ${BOLD}${BLUE}*${NORM} Registering mdev as hotplug agent... " echo "/bin/mdev" > /proc/sys/kernel/hotplug checkReturn @@ -167,7 +161,8 @@ echo -e " ${BOLD}${BLUE}*${NORM} Waiting $DEVTIMEOUT seconds for devices to sett sleep $DEVTIMEOUT # if root=/dev/XXX was specified on the command line, use that as the new root -# instead of searching for the media and using it. if it fails, fall back to the media +# instead of searching for the media and using it. if it fails, fall back to +# the media grep -q "root=/dev/*" /proc/cmdline if [ $? -eq 0 ] then @@ -200,7 +195,7 @@ else find_and_mount_media fi -echo -e "${BOLD}${BLUE}*${NORM} Switching root.\n" +echo -e " ${BOLD}${BLUE}*${NORM} Switching root.\n" echo "$PRINTK" > /proc/sys/kernel/printk echo > /proc/sys/kernel/hotplug umount /sys