#!/bin/sh # make dirs /bin/busybox mkdir -p /dev /proc /sys /newroot # mount needed filesystems mount -t proc none /proc mount -t sysfs none /sys busybox --install -s mdev -s # lvm stuff vgscan vgchange -a y # process command line options init="/sbin/init" root="/dev/lvm/root" CMDLINE=$(cat /proc/cmdline) for i in ${CMDLINE}; do case $i in root\=*) root=$(echo "$i" | cut -d "=" -f 2) ;; init\=*) init=$(echo "$i" | cut -d "=" -f 2) ;; esac done # switch to new root or fallback to sh mount -r ${root} /newroot if [ -x "/newroot/${init}" ]; then umount /sys umount /proc exec /bin/busybox switch_root /newroot ${init} ${CMDLINE} else echo "Something went wrong..." echo "After fixing it you may want to execute:" echo "exec /bin/busybox switch_root /newroot ${init} ${CMDLINE}" loadkmap < /etc/kmap-de exec /bin/sh fi