]> git.friedersdorff.com Git - max/initramfs.git/blob - init
Use absolute paths for executables
[max/initramfs.git] / init
1 #!/bin/busybox sh
2
3 rescue_shell() {
4         /bin/busybox echo "Something went wrong. Dropping you to a shell"
5         /bin/busybox --install -s
6         exec /bin/sh
7 }
8
9 rescue_shell
10
11 # Mount filesystems 
12 /bin/busybox mount -t devtmpfs none /dev || rescue_shell
13 /bin/busybox mount -t proc none /proc || rescue_shell
14 /bin/busybox mount -t sysfs none /sys || rescue_shell
15 echo 0 > /proc/sys/kernel/printk
16
17 # Unlock luks device
18 /sbin/cryptsetup -T 5 luksOpen /dev/sdb3 lukssdb3 || rescue_shell
19
20 # Create LVM nodes /dev/main/root etc
21 /sbin/lvm vgscan --mknodes || rescue_shell
22 /sbin/lvm lvchange -a ly main/root || rescue_shell
23 /sbin/lvm lvchange -a ly main/home || rescue_shell
24 /sbin/lvm lvchange -a ly main/swap || rescue_shell
25 /sbin/lvm vgscan --mknodes || rescue_shell
26
27 # Mount root fs
28 /bin/busybox mount -o ro /dev/main/root /mnt/root || rescue_shell
29
30 # Unmount filesystems
31 /bin/busybox unmount /dev
32
33 # Boot system
34 exec switch_root /mnt/root /sbin/init