#! /bin/sh
#
#   startup.sh -- スタートアップスクリプト (floppy版)
#
#	0.0: Jun. 19, 2004 by Dai ISHIJIMA
#	0.1: Feb. 17, 2007 (乱数パターンと補数)
#	0.2: May  17, 2020 (v20)
#

PATH=/fd-mode:/wipeout
PATH=${PATH}:/usr.bin:/usr/bin:/usr/local/bin:/bin:/usr.sbin:/usr/sbin:/sbin
export PATH=${PATH}:.

export PATTERNFIL=/tmp/pattern.dat

# 起動時のシステムメッセージを保存
dmesg > /var/run/dmesg.boot

# ツール起動
cd /fd-mode
stuff -g > $PATTERNFIL
echo ''
echo '# ------------------------------------------------------------ #'
echo '# All console output will be logged in "/tmp/fd-mode.txt."'
echo '#'
echo '# You can check the scrolled-out messeges'
echo '# with pressing ScrLk key, then cursor up/down keys.'
echo '# To escape scroll lock mode, press ScrLk key, again.'
echo '# ------------------------------------------------------------ #'
echo ''

count=5
keyin=0
while [ $count -ge 0 ]; do
	echo -e "\r$prompt[$count] \c"
	if tread -t 1 -e 1 > /tmp/keyin; then
		count=0
		keyin=`sed -n 1p /tmp/keyin`
	fi
	count=$(( $count - 1 ))
done
echo ''

/bin/sh /fd-mode/mainmenu.sh

# とりあえず対話シェルを動かしておく :-)
/bin/sh -i

exit 0

# EOF
