1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#!/bin/sh
set -e
CONFFILE="/etc/cyphesis/cyphesis.vconf"
# source debconf library
. /usr/share/debconf/confmodule
# set default values
DB_HOST="localhost"
DB_NAME="cyphesis"
DB_USER="cyphesis"
DB_PWD=""
USE_META="false"
# retrieve values from configfile (if present)
if test -f $CONFFILE ; then
DB_HOST=`grep "^dbserver" $CONFFILE | sed -e 's/^dbserver.*\"\(.*\)\"/\1/'`
DB_NAME=`grep "^dbname" $CONFFILE | sed -e 's/^dbname.*\"\(.*\)\"/\1/'`
DB_USER=`grep "^dbuser" $CONFFILE | sed -e 's/^dbuser.*\"\(.*\)\"/\1/'`
DB_PWD=`grep "^dbpasswd" $CONFFILE | sed -e 's/^dbpasswd.*\"\(.*\)\"/\1/'`
USE_META=`grep "^usemetaserver" $CONFFILE | sed -e 's/^usemetaserver.*\"\(.*\)\"/\1/'`
fi
# set actual values
db_set cyphesis-cpp/postgresql/server $DB_HOST
db_set cyphesis-cpp/postgresql/database $DB_NAME
db_set cyphesis-cpp/postgresql/username $DB_USER
db_set cyphesis-cpp/postgresql/password $DB_PWD
db_set cyphesis-cpp/usemetaserver $USE_META
# questions about database connection
db_input high cyphesis-cpp/postgresql/note || true
db_go
db_input medium cyphesis-cpp/postgresql/local_server || true
db_go
db_get cyphesis-cpp/postgresql/local_server
if [ "x$RET" != xtrue ] ;
then
db_input medium cyphesis-cpp/postgresql/server || true
db_go
db_input medium cyphesis-cpp/postgresql/database || true
db_go
db_input medium cyphesis-cpp/postgresql/username || true
db_go
db_input medium cyphesis-cpp/postgresql/password || true
db_go
db_input medium cyphesis-cpp/usemetaserver || true
db_go
fi
|