#!/bin/bash -x

set -e

# source the debconf library
if [ -e "/usr/share/debconf/confmodule" ]; then
    . /usr/share/debconf/confmodule
else
    echo "debconf must be installed. Exiting."
    exit 1
fi


# ask the ORCID client id
db_input high dataone-cn-portal/orcid.client.id || true
db_go || true

# ask the ORCID client secret 
db_input high dataone-cn-portal/orcid.client.secret || true
db_go || true


# ask the java key store password if it can't be got from dataone-cn-os-core/cn.keystore.password
db_get dataone-cn-os-core/cn.keystore.password
KEYSTOREPASSWORD=$RET

if [ "$KEYSTOREPASSWORD" = "" ]; then
    db_input high dataone-cn-portal/cn.keystore.password || true
    db_go || true
fi