#!/bin/ash


# LOCAL

melody()
{
wave $1 220 1
wave $1 440 1
wave $1 880 2
}


cat << END
systest - rustic harware probing in muLinux
See also "scan -h"

END




# MOUSE PORT

read -p "Test mouse (y/n)? " r

if [ "$r" = y ] ; then 
	/bin/scan mouse
fi

# MODEM PORT

echo
read -p "Test modem port (y/n)? " r
if [ "$r" = y ] ; then 
modem=`/bin/scan modem`
echo "Your modem is : $modem"
fi

# PRINTER PORT

read -p "Test printer port (y/n)? " r
if [ "$r" = y ] ; then 
echo -e "is there? Try also with lpr command. \f" > /dev/lp
fi

# SOUND: wave

if [ "`which wave`" ] ; then

	read -p "Test sound device with sine waveform (y/n)? " r
	if [ "$r" = y ] ; then 
	melody	
	fi

        read -p "Test terminal beeper (y/n)? " r
        if [ "$r" = y ] ; then
        melody -c
        fi

fi

# SOUND: digitized voice 

if [ "`which say`" ] ; then
        read -p "Test sound device with digitized voice (y/n)? " r
        if [ "$r" = y ] ; then
	set -- `date`
	set -- `echo $4 | tr : ' '`
	set -x
       	say "The system time is $1:$2"
	say 1 2 3 4 5 6 7 8 9 10
	say "Good morning Vietnam"
	set +x
        fi
fi

# pciprobe 

if [ "`which pciprobe`" ] ; then
read -p "Probe PCI hardware (y/n)? " r
if [ "$r" = y ] ; then
echo
pciprobe
echo
fi
fi

read -p "Scan SCSI Bus (y/n)? " r
if [ "$r" = y ] ; then
echo
scan scsi-bus
echo
fi

read -p "Scan SCSI CDROM and block devices (y/n)? " r
if [ "$r" = y ] ; then
echo "Please, ignore errors"
echo
(
echo "SCSI cdroms"
scan scsi-cdrom
echo "SCSI block devices"
scan scsi-hd
) | less -b "q)uit"
echo
fi



#  LOCAL NETWORK 

read -p "Test local network (y/n)? " r
if [ "$r" = y ] ; then
	ping -c 3 127.0.0.1
fi

#  ETH card 

read -p "Test ethernet card (y/n)? " r
if [ "$r" = y ] ; then
	. /etc/net.conf
        ping -c 3 $IPADDR 
fi

#  OPENED PORTS 

read -p "Test opened TCP/IP port (y/n)? " r
if [ "$r" = y ] ; then
	echo
       	nmap 127.0.0.1 
	echo
fi

#  FTP Server 

read -p "Test FTP server (y/n)? " r
if [ "$r" = y ] ; then
        echo
	clear
	ftpget  -v -h localhost
        echo
fi


# end


rm -f /tmp/log

