-
Notifications
You must be signed in to change notification settings - Fork 1
/
installdb
39 lines (35 loc) · 1.54 KB
/
installdb
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
#! /bin/bash -v
BINDIR="/usr/lib/postgresql/9.2/bin"
BINDIR=`pg_config --bindir`
PORT=5432
PSQL="$BINDIR/psql -p $PORT"
CREATELANG="$BINDIR/createlang -p $PORT"
DB=$1
if [ -z ${DB} ] ; then
echo "You must give the name of the database you wish to use"
echo "useage: install db_name"
exit
fi
# These schema names can be changed.
# There is some overlap of functions, e.g. ob.tpsa and oc.tpsa
# so using the same schema is not recommended. Using public
# for either one (but probably not both) is fine.
OB_SCHEMA=ob
OC_SCHEMA=oc
$PSQL $DB <<EOSQL
Create Schema $OC_SCHEMA;
Comment On Schema $OC_SCHEMA Is 'function for general use with openbabel or rdkit';
Grant Usage On Schema $OC_SCHEMA to public;
EOSQL
$CREATELANG plpythonu $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < varbit.sql.in | $PSQL $DB
sed s/_SCHEMA_/$OB_SCHEMA/g < openbabel-core.sql.in | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < bits.sql.in | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < query.sql.in | sed s/_SCHEMA_/$OB_SCHEMA/g | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < public166keys.sql.in | sed s/_SCHEMA_/$OB_SCHEMA/g | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < similarity.sql.in | sed s/_SCHEMA_/$OB_SCHEMA/g | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < amw.sql.in | sed s/_SCHEMA_/$OB_SCHEMA/g | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < tpsa.sql.in | sed s/_SCHEMA_/$OB_SCHEMA/g | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < glogp.sql.in | sed s/_SCHEMA_/$OB_SCHEMA/g | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < fragments.sql.in | $PSQL $DB
sed s/_OCSCHEMA_/$OC_SCHEMA/g < recap.sql.in | $PSQL $DB