From 9ac1d14079b3bd400a78d650d43fb8bad1d1e7a3 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Mon, 9 Nov 2020 14:22:02 -0500 Subject: fix efivars, add autologin --- init | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'init') diff --git a/init b/init index db96ac4..b1a78f3 100644 --- a/init +++ b/init @@ -10,13 +10,12 @@ mount -t devtmpfs devtmpfs /dev || exit mkdir -p /dev/pts # /dev/pts for dropbear mount -t devpts devpts /dev/pts -# for random seed -mount -t sysfs sysfs /sys -mount -t efivarfs efivarfs /sys/firmware/efi/efivars /etc/modules.sh || exit -load-random-seed /sys/firmware/efi/efivars/LoaderRandomSeed-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f +mount -t efivarfs efivarfs /efivars +load-random-seed /efivars/LoaderRandomSeed-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f +umount /efivars ( ip link set eth0 up @@ -26,8 +25,9 @@ dropbear -p 2222 ) >/dev/null 2>&1 & root=$(findfs UUID=ec8fb072-1200-4275-9494-f6f869187806) || exit -cryptsetup open --tries 65535 --allow-discards "$root" root -# in case of /sbin/unlock +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 @@ -35,5 +35,11 @@ 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 -- cgit v1.2.3-70-g09d2