#! /bin/sh
# © Winfried Trümper 2000

MY_TMPDIR="/tmp/cdr-setup_$$"
mkdir -m 700 "$TMPDIR" || exit 1
cd "$TMPDIR" || exit 1
touch me || exit 1
rm -f me || exit 1
stty >/dev/null || exit 1
cat $0 | uudecode -p <<'EOUU' | ar p - 
UU_DATA_GOES_HERE_BY_CREATE_SETUP
EOUU

source cdr-setup.fnc

get_keystroke(){
    stty raw -echo #</dev/tty >/dev/tty
    KEYSTROKE=`dd bs=1 count=1 2> /dev/null`
    stty -raw echo #</dev/tty >/dev/tty
}
ask_continue(){
    echo "Please press y for yes or n for no."
    while get_keystroke
    do
	case "$KEYSTROKE" in
	    n|N)
		echo "Terminating on user request."
		exit
		;;
	    y|Y)
		break
		;;
	    *)
		;;
	esac    
    echo "Please press y for yes or n for no."
    done
}
get_template(){
}
parse_template(){
    SED_CMD=""
    while 
    do
	KEY="$1"
	test "$#" -gt 0 || break
	shift
	VALUE="$1"
	test "$#" -gt 0 || break
	shift
	SED_CMD="$SED_CMD -e 's¯$KEY¯$VALUE¯g' "
    done
    sed $SED_CMD 
}
get_message(){
    
}

extract_myself(){

cat - <<EOF

Welcome to the setup routine accompanied with the CD-Writing HOWTO.
This script tries its best to set up your Linux-system for writing
CD-ROMs. However, the author disclaims all warranties with regard to this
software, including all implied warranties of merchantability and
fitness for a certain purpose; in no event shall the author be liable
for any special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether in
an action of contract, negligence or other tortious action, arising
out of or in connection with the use of this software.

Short: use this software at your own risk.

Having that said, do you really want to continue?
EOF

ask_continue

RELEASE=`uname -r`
case "$RELEASE" in
    2.3.*)
    2.2.*)
    2.1.*)
    2.0.*)
    1.*|0.*)
	echo "Sorry, your Linux kernel version is too old. Please upgrade
	echo "your kernel first."
        echo "this script. Please note there is no support for kernels older
	echo "Terminating."
	exit 1
    *)
	echo "Sorry, your Linux kernel version is too old. Please upgrade
	echo "your kernel first."
        echo "this script. Please note there is no support for kernels older
	echo "Terminating."
	exit 1
echo "Hallo Welt."
