summaryrefslogblamecommitdiffstats
path: root/init
blob: 723e4ba88bdfcf738480c608a270ecd6c0b890f9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                              
             































                                                                        
#!/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