blob: 428bd119c59c76def1ec73049251cac0d851bbdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/bin/sh
trap 'exec sh' EXIT
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
mount -t proc proc /proc
mount -t devtmpfs devtmpfs /dev || exit
# /dev/pts for dropbear
mount -t devpts devpts /dev/pts
while read -r line; do
case "$line" in
'#'*) ;;
*) modprobe $line || exit
esac
done < /etc/modules
(
ip link set eth0 up
udhcpc -i eth0
# -p 2222 to avoid host key clash
dropbear -p 2222
) >/dev/null 2>&1 &
root=$(findfs UUID=ec8fb072-1200-4275-9494-f6f869187806) || exit
if cryptsetup open --tries 65535 --allow-discards --perf-no_read_workqueue --perf-no_write_workqueue "$root" root; then
autologin=1
fi
[ -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
cd /mnt || exit
if [ -n "$autologin" ]; then
mount -t tmpfs -o mode=755,nodev,nosuid,strictatime tmpfs run || exit
mkdir -p run/systemd/system/getty.target.wants || exit
ln -s /dev/null run/systemd/system/getty.target.wants/getty@tty1.service || exit
ln -s /etc/systemd/system/getty-autologin.service run/systemd/system/getty.target.wants/ || exit
fi
umount -n /dev/pts /dev /proc
exec switch_root . /usr/lib/systemd/systemd
|