stage-1 init: fix debug menu

* Read one char at a time, so user doesn't have to enter "i<ENTER>"
  contrary to the menu;
* Exec shell inside setsid.
This commit is contained in:
Nikolay Amiantov 2019-07-25 18:23:32 +03:00
parent c3a6c8de88
commit fca97dfebc

View File

@ -44,13 +44,13 @@ EOF
*) to ignore the error and continue *) to ignore the error and continue
EOF EOF
read reply read -n 1 reply
if [ -n "$allowShell" -a "$reply" = f ]; then if [ -n "$allowShell" -a "$reply" = f ]; then
exec setsid @shell@ -c "exec @shell@ < /dev/$console >/dev/$console 2>/dev/$console" exec setsid @shell@ -c "exec @shell@ < /dev/$console >/dev/$console 2>/dev/$console"
elif [ -n "$allowShell" -a "$reply" = i ]; then elif [ -n "$allowShell" -a "$reply" = i ]; then
echo "Starting interactive shell..." echo "Starting interactive shell..."
setsid @shell@ -c "@shell@ < /dev/$console >/dev/$console 2>/dev/$console" || fail setsid @shell@ -c "exec @shell@ < /dev/$console >/dev/$console 2>/dev/$console" || fail
elif [ "$reply" = r ]; then elif [ "$reply" = r ]; then
echo "Rebooting..." echo "Rebooting..."
reboot -f reboot -f