#!/bin/bash
inst cryptsetup
+ instmods dm_crypt cbc aes sha256
inst_rules "$moddir/63-luks.rules"
-inst "$moddir/cryptroot.sh" "/bin/cryptroot.sh"
+inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask
-
for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
}
- echo "Starting initrd..."
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
+NEWROOT="/sysroot"
+
trap "emergency_shell" 0
mknod /dev/null c 1 3
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
while :; do
+ [ -d "$NEWROOT/proc" ] && break;
+
for f in /mount/*.sh; do
- [ -x "$f" ] && . "$f";
- [ "$ROOTFS_MOUNTED" ] && break;
+ [ -x "$f" ] && . "$f";
+ [ "$ROOTFS_MOUNTED" ] && break;
done
- [ "$ROOTFS_MOUNTED" ] && break;
+
sleep 1
i=$(($i+1))
- [ $i -gt 10 ] && emergency_shell
+ (
+ flock -s 200
+ [ $i -gt 10 ] && emergency_shell
+ ) 200>/.console_lock
done
+ # pre pivot scripts are sourced just before we switch over to the new root.
+ getarg 'break=pre-pivot' && emergency_shell
+ source_all pre-pivot
+
# by the time we get here, the root filesystem should be mounted.
# Try to find init.
for i in "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do