#!/bin/sh -e
# ola-rdm-tests package configuration script

conffile="/etc/default/ola-rdm-tests"

get_config_file() {
  config_field=$1
  db_field=$2

  if [ -f "$conffile" ] ; then
    VALUE="$(grep "^[ ]*$config_field" $conffile | sed -e "s/^$config_field *= *\"\(.*\)\"/\1/g")" 
    if [ -n "$VALUE" ] ; then
      db_set $db_field "$VALUE"
    fi
  fi
}

# Source debconf library -- we have a Depends line
# to make sure it is there...
. /usr/share/debconf/confmodule
db_version 2.0

if [ "$1" = configure -o "$1" = reconfigure ] ; then
  get_config_file RUN_DAEMON ola-rdm-tests/daemon
  db_input high ola-rdm-tests/daemon || true
  db_go
  db_get ola-rdm-tests/daemon
fi

exit 0
