#!/bin/sh
dialog \
--title "Select clock chip class" \
--menu "Please choose the appropriate clock chip\n\
 class for your card. (current: $1)" \
21 50 10 \
\
"fixed"        "frequency" \
"programmable" "clock" \
\
2> /tmp/.clockclass 

CLOCK_CLASS=$1
CLOCK_TYPE=$2

NEW_CLOCK_CLASS=`cat /tmp/.clockclass`

if [ "$NEW_CLOCK_CLASS" != "" ]; then
  clock/$NEW_CLOCK_CLASS/.configure $2
  NEW_CLOCK_TYPE=`cat /tmp/.clocktype`
  if [ "$NEW_CLOCK_TYPE" != "" ]; then
    CLOCK_CLASS=$NEW_CLOCK_CLASS
    CLOCK_TYPE=$NEW_CLOCK_TYPE
  fi
fi

echo $CLOCK_CLASS>/tmp/.clockclass
echo $CLOCK_TYPE>/tmp/.clocktype
