diff options
Diffstat (limited to 'init')
-rw-r--r-- | init | 57 |
1 files changed, 22 insertions, 35 deletions
@@ -1,46 +1,33 @@ #!/bin/sh -trap 'kill $dropbear_pid; exec sh' EXIT +trap 'exec sh' EXIT -case "$PATH" in - */*) ;; - *) export PATH="/usr/sbin:/usr/bin:/sbin:/bin" ;; -esac +export PATH="/usr/sbin:/usr/bin:/sbin:/bin" mount -t proc proc /proc mount -t devtmpfs devtmpfs /dev +# use -p to avoid "directory exists" error mkdir -p /dev/pts +# /dev/pts for dropbear mount -t devpts devpts /dev/pts -mount -t sysfs sysfs /sys ( ip link set eth0 up -ip addr add 192.168.0.7/24 dev eth0 -exec dropbear -F -s -p 2222 -K 30 -) & -dropbear_pid=$! - -enc_root=$(findfs UUID=26748575-d7a7-418b-8f68-21be7c937500) || exit -cryptsetup open --tries 65535 --allow-discards "$enc_root" root || [ -e /dev/mapper/root ] || exit - -kill $dropbear_pid -dropbear_pid= - -e2fsck -C 0 -E inode_count_fullmap -p /dev/mapper/root -e2fsck_r=$? -if [ $(( e2fsck_r & 2 )) = 2 ]; then - reboot -f -fi -case "$e2fsck_r" in - 0|1) ;; - *) exit -esac - -mount -o nodev,commit=30 /dev/mapper/root /mnt || exit -cd /mnt -umount /dev/pts -mount --move /dev dev -mount --move /proc proc -mount --move /sys sys - -exec switch_root /mnt /usr/lib/systemd/systemd +udhcpc -i eth0 +# -p 2222 to avoid host key clash +dropbear -p 2222 +) >/dev/null 2>&1 & + +root=$(findfs UUID=26748575-d7a7-418b-8f68-21be7c937500) || exit +cryptsetup open --tries 65535 --allow-discards "$root" root +# in case of /sbin/unlock +[ -e /dev/mapper/root ] || exit +e2fsck -C 0 -E inode_count_fullmap -p /dev/mapper/root || exit +mount -o nodev /dev/mapper/root /mnt || exit + +kill -9 -1 +ip link set eth0 down + +cd /mnt || exit +umount -n /dev/pts /dev /proc +exec switch_root . /usr/lib/systemd/systemd |