pmaports/main/postmarketos-mkinitfs-hook-console-shell/console-shell.sh
Ferenc Bakonyi 48fa646f08
main/postmarketos-mkinitfs-hook-console-shell: new aport (MR 1094)
Provides early debug shell via initramfs. Might be useful on devices
without USB networking, works well on PinePhone.
2020-06-05 12:57:22 +02:00

22 lines
483 B
Bash

#!/bin/sh
# shellcheck disable=SC1091
. /etc/deviceinfo
. ./init_functions.sh
# mount pstore, if possible
if [ -d /sys/fs/pstore ]; then
mount -t pstore pstore /sys/fs/pstore || true
fi
if tty -s; then
tty=/dev/tty0
rows=$(stty -F $tty size | awk '{print $1}')
stty -F $tty rows $(($rows * 2 / 3))
fbkeyboard &
echo "Exit the shell to continue booting:" > $tty
sh +m <$tty >$tty 2>$tty
pkill -f fbkeyboard
stty -F $tty rows $rows
else
echo "No tty attached, exiting."
fi