# getty console

# use fgetty if found
#/sbin/fgetty
#/bin/fgetty-login
#/bin/fgetty-login2
#/bin/checkpassword

if [ -e /sbin/fgetty ]; then
  stat_before
  cpifexists /sbin/fgetty        /sbin/
  cpifexists /bin/fgetty-login   /bin/
  cpifexists /bin/fgetty-login2  /bin/
  cpifexists /bin/checkpassword  /bin/

  cat << EOF > $DESTDIR/bin/login
#!/bin/sh
fgetty-login \$@
EOF
  chmod +x $DESTDIR/bin/login

  cat << EOF > $DESTDIR/sbin/rungetty
#!/bin/sh



VEL=38400
CONSOLE_NUMBER=\$1

if [ "\${CONSOLE_NUMBER}" = "" ]; then
  echo "Error: need a console name (example tty1)"
  exit 1
fi

while [ 1 ]; do
    fgetty \$CONSOLE_NUMBER --noclear >/dev/null 2>&1
    sleep 2
done


EOF
  chmod +x $DESTDIR/sbin/rungetty


  stat_after "fgetty (login)"
fi # end of -e /sbin/fgetty

