#! /bin/sh
echo -n "Enter the address of the port that you want to use [0x201] "
read PORT
echo -n "#define PORT " > config.h
if [ -z "$PORT" ];
then
  PORT=0x201
fi
echo $PORT >> config.h
echo -n "Enter the value from $PORT for script 1 [0xec] "
read ON
echo -n "#define ON " >> config.h
if [ -z "$ON" ];
then
  ON=0xec
fi
echo $ON >> config.h
echo -n "Enter then value from $PORT script 2 [0xdc] "
read OFF
echo -n "#define OFF " >> config.h
if [ -z "$OFF" ];
then
  OFF=0xdc
fi
echo $OFF >> config.h
if [ "$ON" = "$OFF" ];
then
  echo "Sorry, but this configuration is useless. Exiting."
  exit 1
fi
echo -n "What should be executed as script 1 [/usr/bin/light] "
read SCRIPT1
echo -n "#define SCRIPT1 " >> config.h
if [ -z "$SCRIPT1" ];
then
  SCRIPT1="/usr/bin/light"
fi
echo \"$SCRIPT1\" >> config.h
echo -n "What should be executed as script 2 [/usr/bin/light] "
read SCRIPT2
echo -n "#define SCRIPT2 " >> config.h
if [ -z "$SCRIPT2" ];
then
  SCRIPT2="/usr/bin/light"
fi
echo \"$SCRIPT2\" >> config.h
echo Configured for port $PORT, with $ON for script 1 and $OFF for script 2.
echo Script 1 is $SCRIPT1, script 2 is $SCRIPT2.
echo Now do a 'make' or 'make switchd' for just getting the executable,
echo or run 'make install' to get light installed.
