#!/bin/busybox sh rescue_shell() { echo "-----" echo "!!!!!" echo "Something went wrong." echo "Dropping into busybox" echo "!!!!!" echo "-----" busybox --install -s exec /bin/sh } /bin/busybox --install -s # Mount the /proc and /sys filesystems. mount -t proc none /proc mount -t sysfs none /sys mount -t devtmpfs none /dev # Do your stuff here. echo " " echo "This init script assembles the RAID6 root as /dev/md3" echo "mounts it as rootfs and, if there are no problems," echo "boots it up, else calls rescue_shell/busybox" echo " " mdadm --assemble /dev/md3 # Mount the root filesystem. mount -o ro /dev/md3 /realroot || rescue_shell # Clean up. umount /dev umount /proc umount /sys # Boot the real thing. exec switch_root /realroot /sbin/init