#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/unixodbc-create-odbc-ini-files - unixODBC - create odbc{inst}.ini # # Creation: 2014-09-20 hbfl # Last Update: $Id$ # # Copyright (c) 2014-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program 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. #---------------------------------------------------------------------------- data_ini_dir='/etc/unixODBC' data_source_dir="${data_ini_dir}/ODBCDataSources" odbc_ini='odbc.ini' odbcinst_ini='odbcinst.ini' # make sure data-source-dir exists mkdir -p ${data_source_dir} # get data-source.files odbc_files=$(find "${data_source_dir}" -maxdepth 1 -type f -name "odbc.*" -printf '%f\n') odbcinst_files=$(find "${data_source_dir}" -maxdepth 1 -type f -name "odbcinst.*" -printf '%f\n') # touch empty file > ${data_ini_dir}/${odbc_ini} > ${data_ini_dir}/${odbcinst_ini} # create ini files from data-source # see odbcinst --help for detailed information if [ -n "${odbcinst_files}" ] then for ini in ${odbcinst_files} do /usr/bin/odbcinst -i -d -f ${data_source_dir}/${ini} done fi if [ -n "${odbc_files}" ] then for ini in ${odbc_files} do /usr/bin/odbcinst -i -s -l -f ${data_source_dir}/${ini} done fi exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------