summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2020-11-09 14:22:02 -0500
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2020-11-09 14:22:02 -0500
commit9ac1d14079b3bd400a78d650d43fb8bad1d1e7a3 (patch)
tree3e5a0e67f27af0fda982d60f13a0fdd458679beb /init
parent0c941101a36a1172b44322657768318c91f6aedc (diff)
downloadminitramfs-9ac1d14079b3bd400a78d650d43fb8bad1d1e7a3.tar.xz
minitramfs-9ac1d14079b3bd400a78d650d43fb8bad1d1e7a3.zip
fix efivars, add autologin
Diffstat (limited to 'init')
-rw-r--r--init18
1 files changed, 12 insertions, 6 deletions
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