removed createXXX.sh files; now these are part of postInstallStation.sh
This commit is contained in:
parent
c212a2df21
commit
d159aa0ec3
|
@ -1,216 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2004 Media Development Loan Fund
|
|
||||||
#
|
|
||||||
# This file is part of the LiveSupport project.
|
|
||||||
# http://livesupport.campware.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# LiveSupport is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# LiveSupport 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 General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with LiveSupport; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Author : $Author: maroy $
|
|
||||||
# Version : $Revision: 1.2 $
|
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/Attic/createDatabase.sh,v $
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# This script reates the database used by LiveSupport
|
|
||||||
#
|
|
||||||
# Invoke as:
|
|
||||||
# ./bin/createDatabase.sh
|
|
||||||
#
|
|
||||||
# To get usage help, try the -h option
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Determine directories, files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=$basedir/bin
|
|
||||||
etcdir=$basedir/etc
|
|
||||||
docdir=$basedir/doc
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
usrdir=$basedir/usr
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Print the usage information for this script.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
printUsage()
|
|
||||||
{
|
|
||||||
echo "LiveSupport scheduler database creation script.";
|
|
||||||
echo "parameters";
|
|
||||||
echo "";
|
|
||||||
echo " -D, --database The name of the LiveSupport database.";
|
|
||||||
echo " [default: LiveSupport]";
|
|
||||||
echo " -s, --dbserver The name of the database server host.";
|
|
||||||
echo " [default: localhost]";
|
|
||||||
echo " -u, --dbuser The name of the database user to access the"
|
|
||||||
echo " database. [default: livesupport]";
|
|
||||||
echo " -w, --dbpassword The database user password.";
|
|
||||||
echo " [default: livesupport]";
|
|
||||||
echo " -h, --help Print this message and exit.";
|
|
||||||
echo "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Process command line parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
CMD=${0##*/}
|
|
||||||
|
|
||||||
opts=$(getopt -o D:hs:u:w: -l database:,dbserver:,dbuser:,dbpassword:,help, -n $CMD -- "$@") || exit 1
|
|
||||||
eval set -- "$opts"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-D|--database)
|
|
||||||
database=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-h|--help)
|
|
||||||
printUsage;
|
|
||||||
exit 0;;
|
|
||||||
-s|--dbserver)
|
|
||||||
dbserver=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-u|--dbuser)
|
|
||||||
dbuser=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-w|--dbpassword)
|
|
||||||
dbpassword=$2;
|
|
||||||
shift; shift;;
|
|
||||||
--)
|
|
||||||
shift;
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized option $1.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x$dbserver" == "x" ]; then
|
|
||||||
dbserver=localhost;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$database" == "x" ]; then
|
|
||||||
database=LiveSupport;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$dbuser" == "x" ]; then
|
|
||||||
dbuser=livesupport;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$dbpassword" == "x" ]; then
|
|
||||||
dbpassword=livesupport;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Creating database for LiveSupport scheduler.";
|
|
||||||
echo "";
|
|
||||||
echo "Using the following parameters:";
|
|
||||||
echo "";
|
|
||||||
echo " database server: $dbserver";
|
|
||||||
echo " database: $database";
|
|
||||||
echo " database user: $dbuser";
|
|
||||||
echo " database user password: $dbpassword";
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# The details of installation
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
ls_dbserver=$dbserver
|
|
||||||
ls_dbuser=$dbuser
|
|
||||||
ls_dbpassword=$dbpassword
|
|
||||||
ls_database=$database
|
|
||||||
|
|
||||||
|
|
||||||
postgres_user=postgres
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Function to check for the existence of an executable on the PATH
|
|
||||||
#
|
|
||||||
# @param $1 the name of the exectuable
|
|
||||||
# @return 0 if the executable exists on the PATH, non-0 otherwise
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
check_exe() {
|
|
||||||
if [ -x "`which $1 2> /dev/null`" ]; then
|
|
||||||
echo "Executable $1 found...";
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
echo "Executable $1 not found...";
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check to see if this script is being run as root
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
if [ `whoami` != "root" ]; then
|
|
||||||
echo "Please run this script as root.";
|
|
||||||
exit ;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check for required tools
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Checking for required tools..."
|
|
||||||
|
|
||||||
check_exe "su" || exit 1;
|
|
||||||
check_exe "psql" || exit 1;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Create the necessary database user and database itself
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Creating database and database user...";
|
|
||||||
|
|
||||||
# FIXME: the below might not work for remote databases
|
|
||||||
|
|
||||||
if [ "x$ls_dbserver" == "xlocalhost" ]; then
|
|
||||||
su - $postgres_user -c "echo \"CREATE USER $ls_dbuser \
|
|
||||||
ENCRYPTED PASSWORD '$ls_dbpassword' \
|
|
||||||
CREATEDB NOCREATEUSER;\" \
|
|
||||||
| psql template1" \
|
|
||||||
|| echo "Couldn't create database user $ls_dbuser.";
|
|
||||||
|
|
||||||
su - $postgres_user -c "echo \"CREATE DATABASE \\\"$ls_database\\\" \
|
|
||||||
OWNER $ls_dbuser ENCODING 'utf-8';\" \
|
|
||||||
| psql template1" \
|
|
||||||
|| echo "Couldn't create database $ls_database.";
|
|
||||||
else
|
|
||||||
echo "Unable to automatically create database user and table for";
|
|
||||||
echo "remote database $ls_dbserver.";
|
|
||||||
echo "Make sure to create database user $ls_dbuser with password";
|
|
||||||
echo "$ls_dbpassword on database server at $ls_dbserver.";
|
|
||||||
echo "Also create a database called $ld_database, owned by this user.";
|
|
||||||
echo "";
|
|
||||||
echo "The easiest way to achieve this is by issuing the following SQL";
|
|
||||||
echo "commands to PostgreSQL:";
|
|
||||||
echo "CREATE USER $ls_dbuser";
|
|
||||||
echo " ENCRYPTED PASSWORD '$ls_dbpassword'";
|
|
||||||
echo " CREATEDB NOCREATEUSER;";
|
|
||||||
echo "CREATE DATABASE \"$ls_database\"";
|
|
||||||
echo " OWNER $ls_dbuser ENCODING 'utf-8';";
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: check for the success of these operations somehow
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Say goodbye
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Done."
|
|
||||||
|
|
|
@ -1,158 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2004 Media Development Loan Fund
|
|
||||||
#
|
|
||||||
# This file is part of the LiveSupport project.
|
|
||||||
# http://livesupport.campware.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# LiveSupport is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# LiveSupport 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 General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with LiveSupport; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Author : $Author: fgerlits $
|
|
||||||
# Version : $Revision: 1.3 $
|
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/Attic/createGstreamerRegistry.sh,v $
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# This script registers Gstremer plugins.
|
|
||||||
#
|
|
||||||
# Invoke as:
|
|
||||||
# ./bin/createGstreamerRegistry.sh
|
|
||||||
#
|
|
||||||
# To get usage help, try the -h option
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Determine directories, files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=$basedir/bin
|
|
||||||
etcdir=$basedir/etc
|
|
||||||
docdir=$basedir/doc
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
usrdir=$basedir/usr
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Print the usage information for this script.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
printUsage()
|
|
||||||
{
|
|
||||||
echo "LiveSupport scheduler Gstreamer registry creating script.";
|
|
||||||
echo "parameters";
|
|
||||||
echo "";
|
|
||||||
echo " -d, --directory The installation directory, required.";
|
|
||||||
echo " -h, --help Print this message and exit.";
|
|
||||||
echo "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Process command line parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
CMD=${0##*/}
|
|
||||||
|
|
||||||
opts=$(getopt -o D:h -l directory:,help -n $CMD -- "$@") || exit 1
|
|
||||||
eval set -- "$opts"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-d|--directory)
|
|
||||||
installdir=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-h|--help)
|
|
||||||
printUsage;
|
|
||||||
exit 0;;
|
|
||||||
--)
|
|
||||||
shift;
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized option $1.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x$installdir" == "x" ]; then
|
|
||||||
echo "Required parameter install directory not specified.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Registering Gstreamer plugins for LiveSupport station.";
|
|
||||||
echo "";
|
|
||||||
echo "Using the following installation parameters:";
|
|
||||||
echo "";
|
|
||||||
echo " installation directory: $installdir";
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# The details of installation
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
install_lib=$installdir/lib
|
|
||||||
install_etc=$installdir/etc
|
|
||||||
install_bin=$installdir/bin
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Function to check for the existence of an executable on the PATH
|
|
||||||
#
|
|
||||||
# @param $1 the name of the exectuable
|
|
||||||
# @return 0 if the executable exists on the PATH, non-0 otherwise
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
check_exe() {
|
|
||||||
if [ -x "`which $1 2> /dev/null`" ]; then
|
|
||||||
echo "Executable $1 found...";
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
echo "Executable $1 not found...";
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check to see if this script is being run as root
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
if [ `whoami` != "root" ]; then
|
|
||||||
echo "Please run this script as root.";
|
|
||||||
exit ;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check for required tools
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Checking for required tools..."
|
|
||||||
|
|
||||||
check_exe "find" || exit 1;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Create the ODBC data source and driver
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
gstreamer_dir=`find $install_lib -type d -name "gstreamer-*"`
|
|
||||||
export LD_LIBRARY_PATH=$install_lib
|
|
||||||
export GST_REGISTRY=$install_etc/gst-registry.xml
|
|
||||||
export GST_PLUGIN_PATH=$gstreamer_dir
|
|
||||||
$install_bin/gst-register > /dev/null 2>&1
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Say goodbye
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Done."
|
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2004 Media Development Loan Fund
|
|
||||||
#
|
|
||||||
# This file is part of the LiveSupport project.
|
|
||||||
# http://livesupport.campware.org/
|
|
||||||
# To report bugs, send an e-mail to bugs@campware.org
|
|
||||||
#
|
|
||||||
# LiveSupport is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# LiveSupport 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 General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with LiveSupport; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Author : $Author: fgerlits $
|
|
||||||
# Version : $Revision: 1.1 $
|
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/Attic/createOdbcDataSource.sh,v $
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# This script creates the ODBC data source needed for LiveSupport scheduler
|
|
||||||
#
|
|
||||||
# Invoke as:
|
|
||||||
# ./bin/createOdbcDataSource.sh
|
|
||||||
#
|
|
||||||
# To get usage help, try the -h option
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Determine directories, files
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
bindir=$basedir/bin
|
|
||||||
etcdir=$basedir/etc
|
|
||||||
docdir=$basedir/doc
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
usrdir=$basedir/usr
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Print the usage information for this script.
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
printUsage()
|
|
||||||
{
|
|
||||||
echo "LiveSupport scheduler ODBC DataSource creating script.";
|
|
||||||
echo "parameters";
|
|
||||||
echo "";
|
|
||||||
echo " -D, --database The name of the LiveSupport database.";
|
|
||||||
echo " [default: LiveSupport]";
|
|
||||||
echo " -s, --dbserver The name of the database server host.";
|
|
||||||
echo " [default: localhost]";
|
|
||||||
echo " -h, --help Print this message and exit.";
|
|
||||||
echo "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Process command line parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
CMD=${0##*/}
|
|
||||||
|
|
||||||
opts=$(getopt -o D:hs: -l database:,dbserver:,help -n $CMD -- "$@") || exit 1
|
|
||||||
eval set -- "$opts"
|
|
||||||
while true; do
|
|
||||||
case "$1" in
|
|
||||||
-D|--database)
|
|
||||||
database=$2;
|
|
||||||
shift; shift;;
|
|
||||||
-s|--dbserver)
|
|
||||||
dbserver=$2;
|
|
||||||
shift; shift;;
|
|
||||||
--)
|
|
||||||
shift;
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
echo "Unrecognized option $1.";
|
|
||||||
printUsage;
|
|
||||||
exit 1;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "x$dbserver" == "x" ]; then
|
|
||||||
dbserver=localhost;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$database" == "x" ]; then
|
|
||||||
database=LiveSupport;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo "Creating ODBC data source for LiveSupport scheduler.";
|
|
||||||
echo "";
|
|
||||||
echo "Using the following installation parameters:";
|
|
||||||
echo "";
|
|
||||||
echo " database server: $dbserver";
|
|
||||||
echo " database: $database";
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# The details of installation
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
ls_dbserver=$dbserver
|
|
||||||
ls_database=$database
|
|
||||||
|
|
||||||
|
|
||||||
replace_sed_string="s/ls_dbserver/$ls_dbserver/; \
|
|
||||||
s/ls_database/$ls_database/;"
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Function to check for the existence of an executable on the PATH
|
|
||||||
#
|
|
||||||
# @param $1 the name of the exectuable
|
|
||||||
# @return 0 if the executable exists on the PATH, non-0 otherwise
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
check_exe() {
|
|
||||||
if [ -x "`which $1 2> /dev/null`" ]; then
|
|
||||||
echo "Executable $1 found...";
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
echo "Executable $1 not found...";
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check to see if this script is being run as root
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
if [ `whoami` != "root" ]; then
|
|
||||||
echo "Please run this script as root.";
|
|
||||||
exit ;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Check for required tools
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Checking for required tools..."
|
|
||||||
|
|
||||||
check_exe "sed" || exit 1;
|
|
||||||
check_exe "grep" || exit 1;
|
|
||||||
check_exe "odbcinst" || exit 1;
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Create the ODBC data source and driver
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Creating ODBC data source and driver...";
|
|
||||||
|
|
||||||
# check where the odbc dirvers are for PostgreSQL
|
|
||||||
if [ -f /usr/lib/libodbcpsql.so ]; then
|
|
||||||
odbcinst_template=$etcdir/odbcinst_template
|
|
||||||
elif [ -f /usr/lib/odbc/psqlodbc.so ]; then
|
|
||||||
odbcinst_template=$etcdir/odbcinst_debian_template
|
|
||||||
else
|
|
||||||
echo "can't find ODBC driver for PostgreSQL neither at /usr/lib";
|
|
||||||
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
|
|
||||||
|
|
||||||
echo "Registering LiveSupport ODBC data source...";
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Say goodbye
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
echo "Done."
|
|
||||||
|
|
Loading…
Reference in New Issue