aboutsummaryrefslogtreecommitdiff
path: root/libs/unixodbc/files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2017-07-02 14:06:34 +0200
committerDaniel Golle <daniel@makrotopia.org>2017-07-02 20:47:26 +0200
commit32989cc486c643d66829231b325b5dbc850e6629 (patch)
treedbc388dc8ba761932dca84fb1a74736148b8766d /libs/unixodbc/files
parentc709189de4c2e525f1dc07e80fd7055ad63d865b (diff)
unixodbc: auto-generate odbcinst.ini
This allows ODBC drivers to create odbcinst.ini-snippets in /etc/odbcinst.ini.d/ which will be assembled into /tmp/etc/odbcinst.ini. /etc/odbcinst.ini is provided as a symlink pointing to /tmp/etc/odbcinst.ini Hence the unixODBC-provided PostgreSQL driver was also given an odbcinst.ini.d snippet. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'libs/unixodbc/files')
-rw-r--r--libs/unixodbc/files/odbc.init26
1 files changed, 26 insertions, 0 deletions
diff --git a/libs/unixodbc/files/odbc.init b/libs/unixodbc/files/odbc.init
new file mode 100644
index 000000000..32ae7f8cc
--- /dev/null
+++ b/libs/unixodbc/files/odbc.init
@@ -0,0 +1,26 @@
+#!/bin/sh /etc/rc.common
+
+START=50
+
+gen_odbcinst() {
+ local inifile
+
+ echo "[ODBC]"
+ echo "Trace = off"
+ echo "TraceFile ="
+
+ for inifile in /etc/odbcinst.ini.d/*.ini; do
+ cat "$inifile"
+ done
+}
+
+start() {
+ [ ! -d /tmp/etc ] && mkdir /tmp/etc
+
+ gen_odbcinst > /tmp/etc/odbcinst.ini.new
+ chmod 0644 /tmp/etc/odbcinst.ini.new
+
+ [ -e /tmp/etc/odbcinst.ini ] && ( rm /tmp/etc/odbcinst.ini || return 1 )
+
+ mv /tmp/etc/odbcinst.ini.new /tmp/etc/odbcinst.ini
+}