From 42d5e5df66eac7d9d8db1a091535878f6307675d Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sat, 12 May 2007 16:18:04 +0000 Subject: - fix init for users that use neither udev nor filesystems git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@205 880c04e9-e011-0410-abf7-b926e227c9cd --- init | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'init') diff --git a/init b/init index 234a6ff..1e1bcca 100644 --- a/init +++ b/init @@ -100,16 +100,33 @@ if [ "${break}" = "y" ]; then PS1="ramfs$ " /bin/sh -i fi -if [ ! -e "${root}" ]; then - err "Unable to create/detect root device '${root}'" - echo "Dropping to a recovery shell... type 'exit' to reboot" - echo "NOTE: klibc contains no 'ls' binary, use 'echo *' instead" - echo "" - echo "If the device '${root}' gets created while you are here," - echo "try adding 'rootdelay=8' or higher to the kernel command-line" - PS1="ramfs$ " /bin/sh -i - msg "Rebooting..." - /bin/reboot +if [ ! -b "${root}" ]; then + # This duplicates code from the filesystem hook + # without this, mkinitcpio would fail for users who use + # neither the udev hook, nor the filesystem hook + msg "\nRoot device '${root}' doesn't exist, attempting to create it" + + eval $(/bin/parseblock "${root}") + if [ "${BLOCKNAME}" = "unknown" ]; then + echo "ERROR: Failed to parse block device name for '${root}'" + elif [ "x${BLOCKDEVICE}" = "x" ]; then + echo "ERROR: Failed to parse block device ids for '${root}'" + else + export root="${BLOCKNAME}" + echo "/bin/mknod \"${BLOCKNAME}\" b ${BLOCKDEVICE}" + /bin/mknod "${BLOCKNAME}" b ${BLOCKDEVICE} >/dev/null + fi + if [ ! -b "${root}" ]; then + err "Unable to create/detect root device '${root}'" + echo "Dropping to a recovery shell... type 'exit' to reboot" + echo "NOTE: klibc contains no 'ls' binary, use 'echo *' instead" + echo "" + echo "If the device '${root}' gets created while you are here," + echo "try adding 'rootdelay=8' or higher to the kernel command-line" + PS1="ramfs$ " /bin/sh -i + msg "Rebooting..." + /bin/reboot + fi fi msg ":: Initramfs Completed - control passing to kinit" -- cgit v1.2.3-24-g4f1b