From c81b316c5c544ab84d367e3b6de2304bb2914e45 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Wed, 21 Jan 2015 22:47:58 +0100 Subject: further simplification --- init | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/init b/init index 2b660c8..19eee10 100755 --- a/init +++ b/init @@ -3,12 +3,11 @@ ROOT=/dev/disk/by-label/rootfs HOME=/dev/disk/by-uuid/092fdc4a-4356-47d9-9272-9a5f58e33bbf - prep_dev() { for opt in `cat /proc/cmdline`; do name=$(echo $opt | cut -d'=' -f 1) - if [ $name == "root" ] || [ $name == "resume" ] || [ $name == "crypt_part" ]; then + if [ $name == "root" ] || [ $name == "crypt_part" ]; then type=$(echo $opt | cut -d'=' -f 2) id=$(echo $opt | cut -d'=' -f 3) if [ $type == LABEL ]; then @@ -17,9 +16,9 @@ prep_dev() prefix="/dev/disk/by-uuid" fi mkdir -p $prefix - full="$prefix/$id" + full="$prefix/$id" if [ ! -e $full ]; then - ln -s $(findfs "$type=$id") $full + ln -s $(findfs "$type=$id") $full fi fi done @@ -35,7 +34,7 @@ rescue_shell() cryptsetup_do() { echo "cryptsetup $1 $2" - cryptsetup -T 3 luksOpen $1 $2 + cryptsetup -T 3 luksOpen $1 $2 } mount_root() @@ -44,24 +43,19 @@ mount_root() mount $1 /newroot } -# setup directories mkdir -p /dev /proc /sys /newroot -# Mount the /dev, /proc and /sys filesystems. mount -t devtmpfs none /dev mount -t proc none /proc mount -t sysfs none /sys -# Do your stuff here. prep_dev cryptsetup_do $HOME home mount_root $ROOT || rescue_shell -# Clean up. umount /dev umount /proc umount /sys -# Boot the real thing. exec switch_root /newroot /sbin/init -- cgit v1.2.3