Created
July 5, 2014 13:08
-
-
Save int128/470e87b96909dd4d1049 to your computer and use it in GitHub Desktop.
/boot/initramfs/content/init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# initramfs script for Linux 2.6 LVM/RAID | |
echo -e “\x1b[1;32m *\x1b[0m Setting up filesystems” | |
/bin/mount -t proc none /proc | |
/bin/mount -t sysfs none /sys | |
/bin/mount -t tmpfs none /dev | |
/bin/mount -t tmpfs none /etc | |
/sbin/mdev -s | |
echo -e “\x1b[1;32m *\x1b[0m Scanning for raid device(s)” | |
echo ‘DEVICE /dev/sd[abcd][0-3]’ > /etc/mdadm.conf | |
/sbin/mdadm —examine —scan » /etc/mdadm.conf | |
for d in `grep -o ‘/dev/md[0-9]’ /etc/mdadm.conf`; do | |
echo -e “\x1b[1;32m *\x1b[0m Activating raid device… $d” | |
/sbin/mdadm —assemble “$d” | |
done | |
echo -e “\x1b[1;32m *\x1b[0m Activating logical volume(s)” | |
/sbin/vgchange -a y | |
echo -e “\x1b[1;32m *\x1b[0m Mounting rootfs… $ROOT” | |
ROOT=”`cat /proc/cmdline | sed -ne ‘s,.*root=\([^ ]*\).*,\1,p’`” | |
[ -b “$ROOT” ] || exec /bin/ash | |
/bin/mount -o ro “$ROOT” /point || exec /bin/ash | |
echo -e “\x1b[1;32m *\x1b[0m Switching rootfs” | |
/bin/umount /sys /proc /dev /etc | |
exec /sbin/switch_root /point /sbin/init | |
exec /bin/ash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment