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