2009-01-22 03:35:17 +03:00
|
|
|
#!/bin/bash
|
2009-04-22 15:48:07 +04:00
|
|
|
# lib_postgresqludf_sys - a library with miscellaneous (operating) system level functions
|
2010-03-04 13:47:31 +03:00
|
|
|
# Copyright (C) 2009-2010 Bernardo Damele A. G.
|
2009-04-22 15:48:07 +04:00
|
|
|
# web: http://bernardodamele.blogspot.com/
|
|
|
|
# email: bernardo.damele@gmail.com
|
2011-06-28 17:12:18 +04:00
|
|
|
#
|
2009-04-22 15:48:07 +04:00
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
2011-06-28 17:12:18 +04:00
|
|
|
#
|
2009-04-22 15:48:07 +04:00
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
2011-06-28 17:12:18 +04:00
|
|
|
#
|
2009-04-22 15:48:07 +04:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
# Adapt the following settings to your environment
|
2010-01-14 03:46:48 +03:00
|
|
|
USER="postgres"
|
2011-06-28 17:12:18 +04:00
|
|
|
#PORT="5435"
|
|
|
|
#VERSION="9.0"
|
2010-01-14 03:46:48 +03:00
|
|
|
PORT="5434"
|
|
|
|
VERSION="8.4"
|
2009-09-26 03:03:45 +04:00
|
|
|
#PORT="5433"
|
2010-01-14 03:46:48 +03:00
|
|
|
#VERSION="8.3"
|
|
|
|
#PORT="5432"
|
2009-09-26 03:03:45 +04:00
|
|
|
#VERSION="8.2"
|
2009-01-22 03:35:17 +03:00
|
|
|
|
|
|
|
echo "Compiling the PostgreSQL UDF"
|
2009-04-22 15:48:07 +04:00
|
|
|
make ${VERSION}
|
2009-01-22 03:35:17 +03:00
|
|
|
|
|
|
|
if test $? -ne 0; then
|
2009-04-22 15:48:07 +04:00
|
|
|
echo "ERROR: You need postgresql-server development software installed"
|
2009-01-22 03:35:17 +03:00
|
|
|
echo "to be able to compile this UDF, on Debian/Ubuntu just run:"
|
2009-04-22 15:48:07 +04:00
|
|
|
|
|
|
|
if test "${VERSION}" == "8.2"; then
|
|
|
|
echo "apt-get install postgresql-server-dev-8.2"
|
2010-01-14 13:50:03 +03:00
|
|
|
elif test "${VERSION}" == "8.3"; then
|
2009-04-22 15:48:07 +04:00
|
|
|
echo "apt-get install postgresql-server-dev-8.3"
|
2010-01-14 13:50:03 +03:00
|
|
|
elif test "${VERSION}" == "8.4"; then
|
2010-01-14 03:46:48 +03:00
|
|
|
echo "apt-get install postgresql-server-dev-8.4"
|
2011-06-28 17:12:18 +04:00
|
|
|
elif test "${VERSION}" == "9.0"; then
|
|
|
|
echo "apt-get install postgresql-server-dev-9.0"
|
2009-04-22 15:48:07 +04:00
|
|
|
fi
|
|
|
|
|
2009-01-22 03:35:17 +03:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "PostgreSQL UDF compiled successfully"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\nPlease provide your PostgreSQL 'postgres' user's password"
|
|
|
|
|
2009-04-22 15:48:07 +04:00
|
|
|
psql -h 127.0.0.1 -p ${PORT} -U ${USER} -q template1 < lib_postgresqludf_sys.sql
|
2009-01-22 03:35:17 +03:00
|
|
|
|
|
|
|
if test $? -ne 0; then
|
|
|
|
echo "ERROR: unable to install the UDF"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "PostgreSQL UDF installed successfully"
|
|
|
|
fi
|