summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2007-05-12 18:18:04 +0200
committerThomas Bächler <thomas@archlinux.org>2007-05-12 18:18:04 +0200
commit42d5e5df66eac7d9d8db1a091535878f6307675d (patch)
treedabe1e4f7d6e78f55a956a930431a91d6c09dcd5
parent00e2615161b589f10d37001feab07ff8fc3d31ca (diff)
downloadmkinitcpio-42d5e5df66eac7d9d8db1a091535878f6307675d.tar.gz
mkinitcpio-42d5e5df66eac7d9d8db1a091535878f6307675d.tar.xz
- 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
-rw-r--r--init37
1 files changed, 27 insertions, 10 deletions
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"