rewrote the ODBC data source install script;

it should handle upgrades better now
This commit is contained in:
fgerlits 2006-11-13 11:28:24 +00:00
parent 7796cde9f4
commit e6e5dc08b7
5 changed files with 19 additions and 19 deletions

View File

@ -155,8 +155,14 @@ check_exe "odbcinst" || exit 1;
#-------------------------------------------------------------------------------
# Create the ODBC data source and driver
#-------------------------------------------------------------------------------
echo "Creating ODBC data source and driver...";
# check for an existing PostgreSQL ODBC driver, and uninstall if necessary
odbcinst_res=`odbcinst -q -d | grep "\[PostgreSQL_Campcaster\]"`
if [ "x$odbcinst_res" != "x" ]; then
echo "Removing old ODBC PostgreSQL driver...";
odbcinst -u -d -n PostgreSQL_Campcaster || exit 1;
fi
echo "Registering ODBC PostgreSQL driver...";
# check where the odbc dirvers are for PostgreSQL
if [ -f /usr/lib/libodbcpsql.so ]; then
odbcinst_template=$etcdir/odbcinst_template
@ -169,17 +175,11 @@ else
echo "nor at /usr/lib/odbc. please install proper ODBC drivers";
exit 1;
fi
odbc_template=$etcdir/odbc_template
odbc_template_tmp=/tmp/odbc_template.$$
# check for an existing PostgreSQL ODBC driver, and only install if necessary
odbcinst_res=`odbcinst -q -d | grep "\[PostgreSQL\]"`
if [ "x$odbcinst_res" == "x" ]; then
echo "Registering ODBC PostgreSQL driver...";
odbcinst -i -d -v -f $odbcinst_template || exit 1;
fi
odbcinst -i -d -f $odbcinst_template || exit 1;
echo "Registering Campcaster ODBC data source...";
odbc_template=$etcdir/odbc_template
odbc_template_tmp=/tmp/odbc_template.$$
cat $odbc_template | sed -e "$replace_sed_string" > $odbc_template_tmp
odbcinst -i -s -l -f $odbc_template_tmp || exit 1;
rm -f $odbc_template_tmp

View File

@ -1,6 +1,6 @@
[ls_database]
Description = the Campcaster database at PostgreSQL
Driver = PostgreSQL
Driver = PostgreSQL_Campcaster
Trace = No
TraceFile = /tmp/sql.log
Database = ls_database

View File

@ -1,5 +1,5 @@
[PostgreSQL]
Description = PostgreSQL driver
[PostgreSQL_Campcaster]
Description = PostgreSQL driver for Campcaster
Driver = /usr/lib/odbc/psqlodbcw.so
Setup = /usr/lib/odbc/libodbcpsqlS.so

View File

@ -1,5 +1,5 @@
[PostgreSQL]
Description = PostgreSQL driver
[PostgreSQL_Campcaster]
Description = PostgreSQL driver for Campcaster
Driver = /usr/lib/odbc/psqlodbc.so
Setup = /usr/lib/odbc/libodbcpsqlS.so

View File

@ -1,5 +1,5 @@
[PostgreSQL]
Description = PostgreSQL driver
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
[PostgreSQL_Campcaster]
Description = PostgreSQL driver for Campcaster
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so