#!/bin/bash

mount -t proc none /proc
mount -t tmpfs none /tmp

cd /dev ; rm -f fd
ln -sf /proc/kcore      core
ln -sf /proc/self/fd    fd
ln -sf fd/0             stdin
ln -sf fd/1             stdout
ln -sf fd/2             stderr
ln -sf misc/psaux	mouse
cd /

exec < /dev/console > /dev/console 2> /dev/console ; cd /
export PATH="/sbin:/bin:/usr/sbin:/usr/bin"

cat << EOF
 _       __     __                             __           __ _    ______
| |     / /__  / /________  ____ ___  ___     / /_____     / /| |  / / __ \\
| | /| / / _ \/ / ___/ __ \/ __ \`__ \/ _ \   / __/ __ \   / / | | / / /_/ /
| |/ |/ /  __/ / /__/ /_/ / / / / / /  __/  / /_/ /_/ /  / /__| |/ / ____/
|__/|__/\___/_/\___/\____/_/ /_/ /_/\___/   \__/\____/  /_____/___/_/

A lot of fun wishes:
The LVP Team:
	-Benjamin 'blindcoder' Schieder
EOF

ttydevs="vc/2 vc/3"

for x in $ttydevs  ; do
   ( ( while : ; do agetty -i 38400 $x -n -l /sbin/login-shell ; done ) & )
done

for x in /etc/lvp/*.sh ; do
   if [ -f "$x" ] ; then
      echo ; echo "Running $x ..." ; sh $x
      echo "Setup script $x finished."
   fi
done

agetty -i 38400 vc/1 -n -l /sbin/startlvp &

exec < /dev/null > /dev/null 2>&1
while : ; do sleep 1 ; done