#!/bin/sh
#
# This script selects the language of the main Olomouc SpareMiNT
# Distribution install script.
#
# This script is automatically executed by mint.cnf when MiNT boots.
#

# First we activate the cursor
echo -n e
# then we activate the auto-wrap
echo -n v

umask 022

echo
echo "Copying installation script(s) into the RAM-Disk..."
echo

/ram/install -v -m 644 ./setup.?? /ram

PATH=".:/ram" ; export PATH

cd u:\

# Fundamental process error
# One way or the other, it doesn't work.... Fixme!

error()
{
case $? in
	0)
		echo
		echo Perfect, everything is good!
		;;
	*)
		echo
		echo Installation script in the selected language was not found. Try to
		echo use the two-letter language shortcut in terms of ISO 639 \(e.g.
		echo cs, de, da\) and NOT the ISO 3166 country codes \(e.g. CZ, AT, DK\).
		echo
		echo It is also possible that the installation script has not been translated
		echo into your language yet. If you know somebody who is able to do that,
		echo please give him/her the file SETUP.EN \(or another language mutation\).
		echo It is necessary to translate all the messages right of the words \"echo\".
		echo
		echo
		echo -n 'Please press RETURN...' ; read j
		echo
		SETUPLANG=""
esac
}

#
# Welcome in OSMD
#

echo
echo
echo
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @@"                                                                       "@@
echo @@"                  "Welcome in the installation of the"                   "@@
echo @@"                                                                       "@@
echo @@"                    "Olomouc SpareMiNT Distribution"                     "@@
echo @@"                                                                       "@@
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo

SETUPLANG=""
while [ -z "$SETUPLANG" ] ; do

	echo
	echo Please choose the language for the installation script. If the script is
	echo not available in your favourite language yet, you will get the information
	echo about it in English and you will have to choose another one.
	echo
	echo "	"cs = cestina
	echo "	"de = Deutsch
	echo "	"en = English
	echo "	  "...
	echo "	 "q = exit
	echo "	 "! = shell
	echo
	echo
	echo -n 'Your choice: ' ; read j

	case $j in
		[Qq])
			echo
			echo The installation won\'t be finished.
			SETUPLANG=""
			exit 0
			;;
		!)
			echo
			echo Entering shell, you can return back by typing \`exit\'...
			SETUPLANG=""
			/ram/sh
			;;
		??)
			SETUPLANG=$j ; export SETUPLANG
			echo
			echo executing /ram/setup.$SETUPLANG
			/ram/sh /ram/setup.$SETUPLANG
			error
			;;
		*)
			echo
			echo Incorrect choice!
			SETUPLANG=""
	esac

done

echo
echo The OSMD I18N script somehow finished. Good bye...
echo

exit 0
