#!/bin/bash
PATH=$PATH:/usr/local/lib/inx
. inx_essentials
maybe_switch

f-intro ()
{
# Re-splash !

splash 
sleep 1.5
clear
fig-col
echo 
figlet "  inx"
echo 

# Check for the terminal type - this falls flat on its face in screen...
if [ $TERM != linux ] ; then
yellow
echo "Sorry, the intro can't run well in GNU Screen or dvtm - try a normal terminal - /dev/tty1 to 6."
white ; unbold ; echo
exit 1
fi

bold
white
printf "  "
for each in You can run this introduction any time by typing
do printf " $each" && sleep .2
done

printf "\n\n\n"
yellow ; bblack ; bold 
echo "     intro " 
white
echo  
echo  
sleep 1

printf "  "
for each in at your command prompt, then hitting enter
do printf " $each" && sleep .2
done 

sleep 3

printf "\n\n\n"
echo "  This is a script that walks you through a few things"
echo "  that you can do with inx - or indeed any console"
echo "  without X graphics, using a framebuffer."

sleep 5

printf "\n\n\n"
sleep 1
printf " "
for each in It is probably not a good idea to interrupt it unless you know what you are doing ";-)" 
do printf " $each" && sleep .2
done
sleep 1.5
printf "\n\n"
echo  "  ... or unless prompted, for example, by an instruction on how to quit a program."
sleep 8

printf  "\n\n  However, you *can* halt the flow with "
yellow ; printf "\"CTRL + s\""
white ; printf ", and resume with "
yellow ; printf "\"CTRL + q\""
sleep 6

white 
clear
echo "  A tty virtual terminal does not have to be frighteningly black..."
sleep 6

for each in bred bcyan bblue byellow bgreen bmagenta
do $each && clear && sleep .8
done

bblack && clear

echo "  ... by default it usually is ...VERY black"

sleep 4

printf "\n\n  "
for each in ...but that "doesn't" HAVE to be frightening ":-)"
do printf " $each" && sleep .3
done
printf "\n\n"
sleep 4

echo 
echo "  The commands to change the colours look like"
echo 
printf "  "
for each in setterm -background magenta -foreground white \&\& clear
do printf " $each" && sleep .4
done
printf "\n\n"
echo "  Or printf \"\\E[35m\" .... umm ... whatever."
printf "\n\n"
sleep 1
echo "  You are not expected to remember that, by the way ..."
printf "\n\n\n\n"
sleep 4
echo "  Well, only for the comprehensive Linux exam coming up right now..."
sleep 7

clear
echo -e "\n\n\n    Just kidding...."
sleep 2
clear

bwhite ; black ; bold && clear
echo -e "\n  You can have plain vanilla"
sleep 4
bblack ; cyan && clear
echo -e "\n\n    Or you can do this"
sleep 3
byellow ; cyan ; bold && clear
figlet -c "OR"
printf "\n\n"
figlet -c "BE REALLY LOUD"
sleep 4
bred ; yellow && clear
echo "  Or even"
echo "         be"
echo "           very"
echo "                silly."
sleep 3
printf "\n\n\n\n"
apt-get moo
sleep 4

bblack ; white ; bold && clear
echo "  But seriously..."
echo 
echo "  there is a lot you can do in inx, or in any tty virtual terminal"
sleep 5
echo 
echo "  Like finding the date and time... (date)"
echo 
bblack ; yellow ; bold
date
sleep 4
echo 

bblack ; white ; bold 
echo "  A small calendar... (cal) "
sleep 2
echo 
echo 
byellow ; cyan ; bold 
cal
echo 
sleep 4
echo 
clear
bblack ; white ; bold 
echo "  Or a year ..."
echo 
byellow ; cyan ; bold 
cal $(date +%Y)
sleep 6
bblack ; white ; bold  && clear

echo "  ...and of course, as the commercials shout, "
sleep 4
clear

for blink in $(seq 1 3) ; do 
bred ; yellow ; bold 
figlet "     THERE'S MORE "\!""
sleep .6
bblack && clear
sleep .3
done

clear

white ; bblack ; bold && clear
echo "   Much, much more ... "
sleep 2
echo "   but this is just an introduction ..."
sleep 4

printf "\n\n\n"

echo "  You can go into more depth later by typing the command"
echo 
yellow
echo "   tutorial"
white
echo 
echo "  More to come - not commands as such... hold on to your hat"
sleep 7
 
bblack ; white && clear
echo "  Here's something you might not expect in a command-line environment."
echo 
echo 
echo "  Type h for help, q for quit when you see it - this is the fbi program "
f-sup
sleep 9

fbi /usr/share/example-content/pictures/*

bblack ; white && clear
echo 
echo 
echo "   ... now for another surprise. q for quit from this one, again... "
f-sup
sleep 6

# Check if we have a default route ( on-line ? )

route | grep default 1> /dev/null
if [ "$?" = "1" ] ; then
    f-sup
    links2-watch /usr/share/example-content/intro-linux/index.html
else
    f-sup
    links2-watch  http://google.com
    clear
fi

bblack ; cyan ; bold && clear
echo 
echo 
echo "  Hah "\!" - bet you weren't expecting that "\!""
printf "\n\n  "
sleep 3
for each in Now for something completely different... wait for it...
do printf " $each" && sleep .3
done

sleep 4
clear
echo "  This one goes for a few minutes - well worth it though."
echo "   q to quit after it starts - if you are in a rush ... "

sleep 6
clear
f-sup
/usr/bin/mplayer /usr/share/video/a_new_computer.ogg 

clear
fig-col
figlet "  inx"
bold
white
echo 
echo "  So much for scary command-lines with boring text ... "
echo 
echo 
echo "  In order, those used the fbi , xlinks2 and mplayer commands "
printf "\n\n"
echo "  That will do for an intro - remember you can re-run it by typing"
yellow
printf "\n"
echo "  intro"
printf "\n"
white 
echo "  At the prompt - or just choose it from the main menu."
printf "\n\n"
echo "  If you want to move on to the command tutorial, "
echo "  as suggested above - you can select it from the main menu. "
echo
echo "  I suggest, though, that you follow the order of the menu to"
echo "  discover a bit about inx first."
echo 
echo 
echo "  To return to the inx menu, just hit any key. "
echo "  Have fun! "

read -s -n 1
exec menu

}
f-intro